1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00

Fix for StringArray tokenising.

This commit is contained in:
Julian Storer 2011-03-30 18:54:40 +01:00
parent 37877037f4
commit d5bbd54f25
3 changed files with 21 additions and 39 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Juce Demo" default="help">
<project name="Juce Demo" default="debug">
<property file="local.properties"/>
<property file="build.properties"/>
<property file="default.properties"/>

View file

@ -14173,29 +14173,20 @@ int StringArray::addTokens (const String& text, const bool preserveQuotedStrings
int StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters)
{
int num = 0;
String::CharPointerType t (text.getCharPointer());
if (text.isNotEmpty())
while (! t.isEmpty())
{
String::CharPointerType t (text.getCharPointer());
String::CharPointerType tokenEnd (CharacterFunctions::findEndOfToken (t,
breakCharacters.getCharPointer(),
quoteCharacters.getCharPointer()));
add (String (t, tokenEnd));
++num;
for (;;)
{
String::CharPointerType tokenEnd (CharacterFunctions::findEndOfToken (t,
breakCharacters.getCharPointer(),
quoteCharacters.getCharPointer()));
if (tokenEnd.isEmpty())
break;
if (tokenEnd == t)
break;
add (String (t, tokenEnd));
++num;
t = tokenEnd;
if (t.isEmpty())
break;
++t;
}
t = ++tokenEnd;
}
return num;

View file

@ -351,29 +351,20 @@ int StringArray::addTokens (const String& text, const bool preserveQuotedStrings
int StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters)
{
int num = 0;
String::CharPointerType t (text.getCharPointer());
if (text.isNotEmpty())
while (! t.isEmpty())
{
String::CharPointerType t (text.getCharPointer());
String::CharPointerType tokenEnd (CharacterFunctions::findEndOfToken (t,
breakCharacters.getCharPointer(),
quoteCharacters.getCharPointer()));
add (String (t, tokenEnd));
++num;
for (;;)
{
String::CharPointerType tokenEnd (CharacterFunctions::findEndOfToken (t,
breakCharacters.getCharPointer(),
quoteCharacters.getCharPointer()));
if (tokenEnd.isEmpty())
break;
if (tokenEnd == t)
break;
add (String (t, tokenEnd));
++num;
t = tokenEnd;
if (t.isEmpty())
break;
++t;
}
t = ++tokenEnd;
}
return num;