Answers for "Splitting every character of a string"

1

split a string every character

# Python3 - separate each character of non-spaced string

def split(string): 
	return [letter for letter in string] 
	
# Driver code 
string = 'split this string'
print(split(string))
Posted by: Guest on November-17-2020
1

split a string into an array of characters

const string = 'hi there';

const usingSplit = string.split('');
const usingSpread = [...string];
const usingArrayFrom = Array.from(string);
const usingObjectAssign = Object.assign([], string);

// Result
// [ 'h', 'i', ' ', 't', 'h', 'e', 'r', 'e' ]
Posted by: Guest on June-02-2021

Code answers related to "Splitting every character of a string"

Python Answers by Framework

Browse Popular Code Answers by Language