Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I'm trying to figure out if I can url encode a string using only TrigML. It says in 11.7.4 Formatting that a format string is not required, meaning that you can supply one if you like. Is there a way that you can say replace any space in a string with a %20 and so forth for other unsafe URL chars? If so what would the syntax look like.

Thanks for any help.

SDBrewGuy wrote:I'm trying to figure out if I can url encode a string using only TrigML. It says in 11.7.4 Formatting that a format string is not required, meaning that you can supply one if you like. Is there a way that you can say replace any space in a string with a %20 and so forth for other unsafe URL chars? If so what would the syntax look like.
Thanks for any help.
check if the below code may help you
char *add_persenatge_to_req(b_module *pMe,char *str)
{
int i=0,j=0;
char data[200]={0};
char *temp_str=NULL;
emptychararray(data,200);
while (str[i]!='\0')
{
if(str[i]==' ')
{
data[j++]='%';
data[j++]='2';
data[j]='0';
}
else if(str[i]==':')
{
data[j++]='%';
data[j++]='3';
data[j]='A';
}
else if(str[i]=='/')
{
data[j++]='%';
data[j++]='2';
data[j]='F';
}
else
{
data[j]=str[i];
}
j++;i++;
}
temp_str=(char*)MALLOC(j+1);
copy_char_to_string(temp_str,data);
return temp_str;

SDBrewGuy wrote:I'm trying to figure out if I can url encode a string using only TrigML. It says in 11.7.4 Formatting that a format string is not required, meaning that you can supply one if you like. Is there a way that you can say replace any space in a string with a %20 and so forth for other unsafe URL chars? If so what would the syntax look like.
Thanks for any help.
check if the below code may help you
char *add_persenatge_to_req(b_module *pMe,char *str)
{
int i=0,j=0;
char data[200]={0};
char *temp_str=NULL;
emptychararray(data,200);
while (str[i]!='\0')
{
if(str[i]==' ')
{
data[j++]='%';
data[j++]='2';
data[j]='0';
}
else if(str[i]==':')
{
data[j++]='%';
data[j++]='3';
data[j]='A';
}
else if(str[i]=='/')
{
data[j++]='%';
data[j++]='2';
data[j]='F';
}
else
{
data[j]=str[i];
}
j++;i++;
}
temp_str=(char*)MALLOC(j+1);
copy_char_to_string(temp_str,data);
return temp_str;

Yes this would work if I wasn't using TrigML. I need to know if you can use settext format="FORMATSTRING" where FORMATSTRING would be the syntax to replace a space or other character.

Yes this would work if I wasn't using TrigML. I need to know if you can use settext format="FORMATSTRING" where FORMATSTRING would be the syntax to replace a space or other character.