for(int n = 0; n < line.length(); ++n)
{
char c = line.charAt(n) ;
String hexValue = Integer.toHexString(c);
if(c >= 65 && c <= 90 && c != 32)
{
newLine = newLine + c;
}
else if(c >= 97 && c <= 122 && c != 32)
{
newLine = newLine + c ;
}
else if(c >= 48 && c <= 57 && c != 32)
{
newLine = newLine + c ;
}
else if(c == 95 || c == 45 || c == 46 || c == 42)
{
newLine = newLine + c ;
}
else if(32 == c)
{
newLine = newLine + '+';
}
else
{
newLine = newLine + '%' + hexValue ;
}
}
Is it possible to combine the top four sections of the if statement? As you can see they all have the same statement(newLine = newLine + c).

New Topic/Question
Reply




MultiQuote


|