How do you separate numbers and letters in a string?
A series of letters and numbers. How to split a string into subsets of letters or numbers based on the boundary between letters and numbers and vice versa.
Method: The re.split(pattern, string) strategy coordinates with all events of the example in the string and partitions the string along the matches bringing about a rundown of strings between the matches.
- import re
- s = '111A222B333C'
- res = re.split('(\d+)', s)
- print(res)
This code is done in python. There are various methods to separate numbers and letters in a string. just search in the google search box and you can see various result on the SERP(search engine result page)
Comments
Post a Comment