What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-07 14:11:17
check how many of a word is in a string
function countOccurences(str,word) { // split the string by spaces in a String a[] = str.split(","); // search for pattern in a int count = 0; for (int i = 0; i < a.length; i++) { // if match found inc... Add solution -
Python 2021-09-20 16:49:01
string to list python
# To split the string at every character use the list() function word = 'abc' L = list(word) L # Output: # ['a', 'b', 'c'] # To split the string at a specific character use the split() function word = 'a,b,c' L = word.split(',') L # Output: # ['a', 'b', ... Add solution -
Python 2021-09-12 15:09:03
parsing text in python
my_string = 'Names: Romeo, Juliet' # split the string at ':' step_0 = my_string.split(':') # get the first slice of the list step_1 = step_0[1] # split the string at ',' step_2 = step_1.split(',') # strip leading and trailing edge spaces of each item ... Add solution -
Python 2021-08-29 19:54:02
how to convert a string to a list python
# To split the string at every character use the list() function word = 'abc' L = list(word) L # Output: # ['a', 'b', 'c'] # To split the string at a specific character use the split() function word = 'a,b,c' L = word.split(',') L # Output: # ['a', 'b', ... Add solution -
Shell/Bash 2021-08-27 19:47:03
bash split string with awk
# Basic syntax: awk '{split($column_to_split,array_name,"delimiter"); print a[index]}' # Where: # - the array_name is usually shortened to a # - delimiter is the delimiter you want to split the string by # - index is the index of the string &quo... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5