Highlighted
Contributor.. Contributor..
Contributor..
1717 views

String conversion to ASCII numbers in LR/VUGEN

Jump to solution

Hi Experts,

Need some help with coding in LR,

I want to convert the String into ASCII numbers.

Below is the small code I am using,

char *value="NmB6F/5Xlo==";

    int i;

        for(i=0; i<=strlen(value)-1; i++)
    {
          lr_output_message("The ASCII value is %d", value[i]);

  }

But with this the output I am getting is like,

Action.c(27): The ASCII value is 78
Action.c(27): The ASCII value is 109
Action.c(27): The ASCII value is 66
Action.c(27): The ASCII value is 54

I want it like,

78:109:66:54

Please help me in this context.

Best Regards,

Ak

0 Likes
1 Solution

Accepted Solutions
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: String conversion to ASCII numbers in LR/VUGEN

Jump to solution

Hello, 

LR can call many Crt functions, so it's just a C programming question. 

 

 char *value="NmB6F/5Xlo==";
 char buf[128];
 int len = strlen(value), i=0, c=0;
 for(; i<len; ++i) {
     c += sprintf(buf+c, i? ":%d" : "%d", value[i] );
 }
 lr_message(buf);

View solution in original post

2 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: String conversion to ASCII numbers in LR/VUGEN

Jump to solution

Hello, 

LR can call many Crt functions, so it's just a C programming question. 

 

 char *value="NmB6F/5Xlo==";
 char buf[128];
 int len = strlen(value), i=0, c=0;
 for(; i<len; ++i) {
     c += sprintf(buf+c, i? ":%d" : "%d", value[i] );
 }
 lr_message(buf);

View solution in original post

Highlighted
Contributor.. Contributor..
Contributor..

Re: String conversion to ASCII numbers in LR/VUGEN

Jump to solution

Great.....It worked...

 

Thanks very much Bingle...

 

Best Regards,

 

Ak

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.