Method 1: Using substring() Method.
Example: This example uses the above-explained approach.
Original String = "GeeksforGeeks" n = 5 Keep first 5 characters of original String = "Geeks"
Method 2: Using slice() Method.
Example: This example shows the above-explained approach.
Original String = "Data Structure" n = 11 Keep first 11 characters of original String = "Data Struct"
My Personal Notes arrow_drop_up
Please Login to comment...