Notifications
Announcements
No record found.
How can I count the numbers of digits in string var?
For example if the number of digits is more than 14 digits it will throw an error?
*This post is locked for comments
strLen(strKeep('blah 1 blah 2', '0123456789'))
Hai,
How can i find number of upper case letters in given string?
thanks,
Suresh.N
A trivial approach would be something like strLen(strKeep(textToCheck, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')).
Here is my take on finding the number of uppercase letters:
static void Job5(Args _args) { str txtToCheck = "ABCdefGHIjklm123ÆØÅ"; int i; Counter uppercaseLetters; for (i = 0; i < strLen(txtToCheck); i++) { if (System.Char::IsUpper(txtToCheck, i)) { uppercaseLetters++; } } info (strFmt("The string '%1' has %2 uppercase letters", txtToCheck, uppercaseLetters)); }
Hi Palle
how to check for number of commas in the string
Martin kind of answered that above, but you could do like this:
static void commas(Args _args) { str stringWithCommas = 'Here, is a string with commas (,)'; info (strFmt("The string has %1 commas", strLen(strKeep(stringWithCommas, ',')))); }
thank you very much it worked...
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Priya_K 4
Martin Dráb 4 Most Valuable Professional
Ali Zaidi 2