How can we convert an input string in css to an array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 19

How can we convert an input string in css to an array

I want to change the input string in css into an array containing each string alphabet as an independent and individual element. How can we measure or count no. elements in an array specified to a certain extent.??Thank you to all of you

29th Dec 2018, 9:33 PM
dand
dand - avatar
2 Answers
+ 5
CSS...? Are you sure your writing is correct? Maybe C++ (aka cpp)? if you use a "string" datatype and save cin input in it, you can aswell use it as an array of characters, with each character accessed as with normal arrays - using [ ]. You can also use the lenght() functiom an object of string type has to get the lenght of the string
29th Dec 2018, 10:19 PM
Data
Data - avatar
+ 3
I m not a cpp(i think you are talking about it) expert but according to my programming knowledge first split the string. This link is a tutorial in splitting. https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-split-a-string-in-cc-JUMP_LINK__&&__python__&&__JUMP_LINK-and-java/amp/ Then iterate over the stored array after splitting and add them to a newly created array. NOTE: Use an if statement to check if that array contains that element already. I think you got my idea.
31st Dec 2018, 2:38 PM
Seniru
Seniru - avatar