Author Topic: Detecting if a substring is in a particular string  (Read 46 times)


  • Senior Community Member
  • Posts: 175
  • Hero Points: 2
Detecting if a substring is in a particular string
« on: February 12, 2018, 11:42:26 pm »
Good day,

I'm trying check if a path has the following string:
Code: [Select]

For example the function would return true for the following path:
Code: [Select]

Is there a builtin function I can use for this? Or does anyone have a
snippet that returns true if it has that string?

I have set up mirror folders between a unix and windows machine and I'm trying to build
the unix path based on its windows equivalent, this is what I have so far. If anyone
knows a better way to do this at least for joining the paths.. let me know

Code: [Select]
    _command void copy_unix_path() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
    _str machineName, unixHome;
    int status = LoadRsyncIniFile(machineName, unixHome);

    /* Get the directory name and file name */
    _str dirName = _strip_filename(p_buf_name,'N');
    _str filName = _strip_filename(p_buf_name,'P');

    _str windHome = 'C:\' :+ machineName :+ '\qa\';
    _str relaPath = substr(dirName, windHome._length());
    relaPath = stranslate(relaPath, '/',   '\');
    _str fullPath = unixHome :+ relaPath;

    _copy_text_to_clipboard(fullPath :+ filName);
    // _copy_text_to_clipboard(_strip_filename(p_buf_name,'PE'));

« Last Edit: February 12, 2018, 11:44:56 pm by flethuseo »