Answers for "how to split a string"

26

how to split a string by character in python

def split(word): 
    return [char for char in word]  
      
# Driver code 
word = 'geeks'
print(split(word)) 

#Output ['g', 'e', 'e', 'k', 's']
Posted by: Guest on December-07-2019
0

string split method

var str = "How are you doing today?";

var res = str.split(" ", 3);
Posted by: Guest on April-03-2021
0

split string

String[] result = "this is a test".split("\s");
     for (int x=0; x<result.length; x++)
         System.out.println(result[x]);
Posted by: Guest on June-11-2021
-2

how to saperate string to array

Scanner in=new Scanner(System.in);
		String input=in.nextLine();
		String[] word=input.split(" ");
Posted by: Guest on May-30-2020

Code answers related to "how to split a string"

Python Answers by Framework

Browse Popular Code Answers by Language