TheBigWeb 40 Posted February 28, 2014 Report Share Posted February 28, 2014 Hi Guys, I couldn't find a UBot command to do this so I wrote a quick function (uses Regex). The one included with UBot changes each word in the string to uppercase whereas this changes just the first letter of a string (sentence). define $ucFirst(#pString) { return($replace regular expression(#pString, "^[\\s\\S]\{0,1\}", $change text casing($substring(#pString, 0, 1), "Upper Case")))} Quote Link to post Share on other sites
TheBigWeb 40 Posted February 28, 2014 Author Report Share Posted February 28, 2014 That function changes all the words first letters to uppercase. The function I did above does the first character of the sentence / string (not each word). If that makes sense. 'this string becomes' - 'This String Becomes' - UBot Function'this string becomes' - 'This string becomes' - My function above. Quote Link to post Share on other sites
UBotDev 276 Posted February 28, 2014 Report Share Posted February 28, 2014 You could also do that without regex: define $ucFirst(#pString) { return("{$change text casing($substring(#pString, 0, 1), "Upper Case")}{$substring(#pString, 1, $subtract($text length(#pString), 1))}") } 1 Quote Link to post Share on other sites
TheBigWeb 40 Posted February 28, 2014 Author Report Share Posted February 28, 2014 You could also do that without regex: define $ucFirst(#pString) { return("{$change text casing($substring(#pString, 0, 1), "Upper Case")}{$substring(#pString, 1, $subtract($text length(#pString), 1))}") } You are right Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.