Skip to content

GetPositionIndex

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Examines the supplied variable and returns the index of the first occurrence of the specified character.

Parameters

SpecName (constant) The variable containing the input to be converted.

Text (multiple) The value to search for the specified character.

CharacterToFind (multiple) The value containing the character for search.

StartPosition (multiple | optional) The character index to begin the search. The default value is 0.

ErrorMessage (multiple | optional) The error message to return when any error occurs.

Synopsis

This method searches the variable for the first instance of the search character. For example, if you search for the letter "o" in Four51 the returned value will be 2. The optional StartPosition parameter allows you to choose to begin the search at a designated index. For example, if you search for "o" in "You are using Four51 Document Actions" with a StartPosition of 10 the result will be 15.

Source Code

public static void GetPositionIndex(string SpecName, object Text, object CharacterToFind, object StartPosition, object ErrorMessage)
{
	Break();
	try
	{
		Variable(SpecName).Value = Text.ToString().IndexOf((string)CharacterToFind, (int)N(StartPosition)).ToString();
	}
	catch (Exception ex)
	{
		throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
	}
}

Referenced Methods

Clone this wiki locally