String API enhancement ideas.

LAHAYE Olivier olivier.lahaye at cea.fr
Tue May 16 15:32:48 UTC 2017


Would be cool in future release to have a better String API.
String.Match(regexp) => return position of match or -1 if it doesn't match
String.Replace(regexp,flag) (where flag is i for insensitive, g for global, ....)
String.ToUpper()
String.ToLower()

Also string<-> numbers convertion could be achieved with + operator.

Adding a string containing a number to an existing number should result a number or #NaN (not a number)
Adding a number to an existing string should concatenate that number.
By that way you can address all needs.
a = 8 + "45" // a=53
a = 0 + "37" // a=37 (converted from string to number)
a = "" + 32 // a="32" (number converted to string (actual behavior)
a = 8 + "foo" // a="#NaN"

My 2 cents.
--
   Olivier LAHAYE
   CEA DRT/LIST/DIR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/plymouth/attachments/20170516/5f64303e/attachment.html>


More information about the plymouth mailing list