We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I working on a project when I load a value from online xml table ( it's time, for example 12:45 PM) and I need the value to convert, I'd like to have just 1245. Something like substring but for dynamic value. I need to work with this number afterwards, so it was a whole number without letters or anything. Thanks for all your suggestions!!
Answers
https://Processing.org/reference/splitTokens_.html
yee so the value is online on the url, i just know the value is 12:45 pm and I need clear number like 1245. Please help with that.
There are different methods to extact parts of a string. Here are three different approaches:
This would work, but there is problem that is loaded from XML which is placed on the interned so the String is in the document described as
but thanks for this solution benja! I am saving it for the next time
https://processing.org/reference/XML.html
@honzojd: As with your other post: include a sample of the XML. If the time is in a standard datetime format you should be able to parse it directly to a date object, which is probably your intention...
@benja: if the intention is to do something programmatically with the time values then none of your suggestions are especially useful as you're simply swapping one string representation for another. @GoToLoop's suggestion is better, but a datetime parser may be the best option depending on the string being parsed...
@blindfish: I've updated the comment "sorry for the HTML in the middle". Btw: good wise answer, thank you for this comment. Yes that's my intention but I don't know how to do it when I am not able to edit the XML and substrings didn't work :/