The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 printing and comparing a string with special char
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Xlsx

USA
2 Posts

Posted - 05/27/2023 :  3:29:09 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2023 (64-bit). and Service Release (10.0.0.154):
Operating System: Windows 10

Hi Origin Team,
I'm attempting todo a string comparison of the contents of one of my columns so I can preform further steps if its a match, However the imported Data contains the special '%' character which it interprets as a string register. How can I escape this so that it treats it like a regular string?
Example Column I'm referencing:



for(int ii = 1; ii < wks.ncols; ii+=1 )
{
string column$ = wcol(ii)[C]$;

int compareStrings = Compare(column$, 'Baseline 100%T',1);
type $(compareStrings);
}

Thank you for your help,
Robbie

cpyang

USA
1406 Posts

Posted - 05/28/2023 :  07:47:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There might be a system variable to disable such substitutions, but you can always prevent % substitution by using %%, like


Compare(column$, 'Baseline 100%%T',1);


CP
Go to Top of Page

Xlsx

USA
2 Posts

Posted - 06/22/2023 :  11:14:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

There might be a system variable to disable such substitutions, but you can always prevent % substitution by using %%, like


Compare(column$, 'Baseline 100%%T',1);


CP



Thank you!

Robbie G
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000