Browse Source

Fix for StringArray tokenising.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
d5bbd54f25
3 changed files with 21 additions and 39 deletions
  1. +1
    -1
      extras/JuceDemo/Builds/Android/build.xml
  2. +10
    -19
      juce_amalgamated.cpp
  3. +10
    -19
      src/text/juce_StringArray.cpp

+ 1
- 1
extras/JuceDemo/Builds/Android/build.xml View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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="local.properties"/>
<property file="build.properties"/> <property file="build.properties"/>
<property file="default.properties"/> <property file="default.properties"/>


+ 10
- 19
juce_amalgamated.cpp 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 StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters)
{ {
int num = 0; 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 == t)
break;

add (String (t, tokenEnd));
++num;
t = tokenEnd;

if (t.isEmpty())
break;
if (tokenEnd.isEmpty())
break;


++t;
}
t = ++tokenEnd;
} }


return num; return num;


+ 10
- 19
src/text/juce_StringArray.cpp 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 StringArray::addTokens (const String& text, const String& breakCharacters, const String& quoteCharacters)
{ {
int num = 0; 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 == t)
break;
if (tokenEnd.isEmpty())
break;
add (String (t, tokenEnd));
++num;
t = tokenEnd;
if (t.isEmpty())
break;
++t;
}
t = ++tokenEnd;
} }
return num; return num;


Loading…
Cancel
Save