About separate a string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About separate a string

a little question.. if there is a string which like S65S7352S7357S636S5262S5 is it possible to separate all the item to S65 S7352 S7357 S636 S5262.. which are start from "S"? Thank you so much!

10th Oct 2020, 1:50 AM
Joe Ma
Joe Ma - avatar
4 Answers
+ 4
Jan Markus Now you've got a pesky initial space to get rid of 😁
10th Oct 2020, 3:57 AM
David Ashton
David Ashton - avatar
+ 3
Try your best if you won't get then we will help you out from error! Provide us a sample code of your hardwork on it and do mention language in tag:) .
10th Oct 2020, 2:00 AM
chaithra Gowda
chaithra Gowda - avatar
+ 1
What language? All are similar but differents way. You could use delimiter. Java: Scanner sc = new Scanner(string); sc.useDelimiter("S"). And regex are nice. Regex regex =S\d+ S: look for literal "S". \d: look for number. +: Matches more than one number, till find the S again and be another match.
12th Oct 2020, 1:20 AM
Marcelo Anjos
Marcelo Anjos - avatar
0
I will do it next time! Thanks for your help Jan & Chaithra🙏
10th Oct 2020, 2:02 AM
Joe Ma
Joe Ma - avatar