Clarity Service Management

CA SDM::.SPEL::. Sindex 

01-25-2017 07:36 AM

sindex

 

Overview

A spel function which, although much diffrent in syntax, works similar to regex (Regular Expression) string matches found in most other programming languages.

Returns the index of the first appearance of the pattern in the search string. Patterns can be regular expressions.

Usage

int sindex(string search_str, string pattern, [int start_index]);

Returns the index of the first appearance of PATTERN in the SEARCH_STR from the initial INDEX, when informed.

Results

Sindex will return a -1 is no match is found or the position of the first character of the match. Position count starts from zero.

Examples

  • If statement using sindex (matching a string against a string)
printf(sindex("test string", "test")); // 0
if (sindex("test string", "test") == 0) {     return;}

printf(sindex("test string", "test", 5)); // -1
  • Pushing the results of sindex into a variable (matching a string in another variable)
int results;
results = sindex(group.id, "776B094702EABB4B87F04A139E72D44B");
if (results == -1) {
     set_return_data("No Match");
} else {
     set_return_data("Match!");
}
// Regular expression example
sindex(action_desc, "(wf:[0-9]+)");

// This will print "sindex: 2"
printf("sindex: %d\n", sindex("This is a test message.", "is"));

Statistics
0 Favorited
3 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

09-05-2018 05:25 AM

Thanks a lot for the confirmation. As long as the information is useful, the typos and different locale is okay. I will fix those . Will collaborate with you as discussed. 

 

Thanks again for putting together this and other articles on installation. Most of the time, i find your articles really helpful from an end-user perspective. 

09-03-2018 11:24 AM

Hi naira11,

 

    I'ts amazing, i really would like to see us colaborating on community. We are together.

 

   Feel free to update any article.

 

   I'm sorry by my mistakes, please if do you to see any erro, please fix it.

 

   Probally you'll find so many even in my english that isn't my mother language.

 

   My articles were written for a community to be used for us and to be improving for us.

 

Regards

Tiago Macul

08-31-2018 07:56 AM

Hi TMACUL

 

Thanks for posting this article. I am from the documentation team, and I guess, as of now, we do not have much information on SPEL documentation on DocOps. Do you think we can leverage this information in CA SDM Documentation? SPEL documentation - what we have now on DocOps seems to be carried forward from 12.9. I checked both 12.9 and 14.1 CA SM Documentation, SPEL is misspelled and is available as "Spell Macro" on DocOps: Spell Macro - CA Service Management - 14.1 - CA Technologies Documentation 

 

I looked at your earlier post related to SPEL Where can I find Spel functions documentation? I was thinking if we can improve the CA SDM documentation by leveraging your articles, it would be great. Let me know your thoughts on this.

 

iyeak01 and Raghu.Rudraraju 

 

Thanks,

Rajashree

08-30-2018 09:41 AM

HI Daniel Becker Bighelini,

 

  Thank you for improving this document.

 

Regards

Tiago Macul

Related Entries and Links

No Related Resource entered.