Discuss any 3rd-party tools and code that may be of interest to other Juce users
by justin » Thu Mar 04, 2010 12:32 pm
Hoping Julian add's to the String class...
(Useful for CamelCase)
- Code: Select all
const String String::toTitleCase () const throw()
{
String result (*this);
result.dupeInternalIfMultiplyReferenced();
tchar* t = result.text->text;
bool wordStart=true;
while (*t != 0)
{
if (CharacterFunctions::isWhitespace(*t) || !CharacterFunctions::isLetterOrDigit(*t))
{
wordStart = true;
}
else if (wordStart == true)
{
CharacterFunctions::toUpperCase(t);
wordStart = false;
}
else
{
CharacterFunctions::toLowerCase(t);
}
++t;
}
return result;
}
-

justin
- JUCE UberWeenie
-
- Posts: 297
- Joined: Mon May 19, 2008 1:37 pm
- Location: Canada
by jules » Sun Mar 07, 2010 9:22 pm
Can't quite decide if that's a good candidate for the String class or not... It feels a bit too language-specific really..
-

jules
- Fearless Leader
-
- Posts: 17189
- Joined: Mon Sep 06, 2004 9:03 am
- Location: London, UK
-
by justin » Tue Mar 09, 2010 11:22 pm
True... but toUppercase and toLowercase are in there!

-

justin
- JUCE UberWeenie
-
- Posts: 297
- Joined: Mon May 19, 2008 1:37 pm
- Location: Canada
Return to Useful Tools and Components
Who is online
Users browsing this forum: Heritrix [Crawler] and 2 guests