1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

How to compare strings?

  • x9tech
  • November 14, 2014 at 1:46 AM
  • Thread is Resolved
  • x9tech
    Trophies
    4
    Posts
    99
    • November 14, 2014 at 1:46 AM
    • #1

    I have a string variable STRIN[100] that is accepting string input from an external source...

    I want to process this via a few IF statements and react accordingly.

    How would I compare to see if STRIN[] == OTHER_STR[] ?

  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • November 14, 2014 at 2:08 AM
    • #2

    use STRCOMP() or use loop to check the strings yourself (char by char) :icon_wink:

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • x9tech
    Trophies
    4
    Posts
    99
    • November 14, 2014 at 3:26 AM
    • #3

    I get a 'Name not declared as function' when trying to use STRCOMP(STRIN[],"TEST")... is this an add-on function?

  • Fubini
    Reactions Received
    282
    Trophies
    9
    Posts
    1,903
    • November 14, 2014 at 6:12 AM
    • #4

    No its available since quite some time:
    BOOL StrComp (CHAR strComp1[470] :IN, CHAR strComp2[470] :IN, CASE_SENSE_T CaseSens :IN)

    strComp1 string to compare with strComp2
    strComp2 string to compare with strComp1
    CaseSens case sensitive or not (#CASE_SENS, #NOT_CASE_SENS)
    return value Returns TRUE if the strings are equal

    The following simple test worked fine for me

    bool result
    ...
    result = StrComp ("ABC”, "ABC”, (#CASE_SENS)) 
    result = StrComp ("ABC”, "abc”, (#NOT_CASE_SENS))
    result = StrComp ("ABC”, "abc”, (#CASE_SENS))
    result = StrComp ("ABC”, "acb”, (#NOT_CASE_SENS))

    Did you assign your result to a boolean?

    Fubini

  • AdrianoD
    Trophies
    2
    Posts
    1
    • January 26, 2023 at 9:44 AM
    • #5

    Hallo ,Ich Habe eine KRC1 V4.1.7 SP5, und versuche gerade Strings zu vergleichen.

    Bin noch Anfänger habe die RS232 über com2 am laufen und möchte darüber strings vergleichen.

    Fehlermeldung Name nicht als Funktion vereinbart kommt wenn ich das schreibe

    IF StrComp (RX_Buffer[],RX_BUFFER_SOLL[],#CASE_SENS)==TRUE THEN

    Was mus ich denn genau declarieren um die Funktion ans laufen zu bekommen?

    Habe StrComp als BOOL schon versucht.

  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • January 26, 2023 at 4:35 PM
    • #6

    please use English in this forum.

    that KSS is too old and does not have string functions, ON_ERROR_PROCEED, $ERR etc.

    this means you need to use a workaround such as external function or using fixed length strings where you specify the max length to compare.

    example comparing first 3 characters (match):

    example comparing 5 characters (mismatch):

    not sure how to check string length in so old KSS so your strings may need to be padded with spaces

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Users Viewing This Thread

  • 1 Guest
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download