Get position of sub string in Google Sheet script

Get position of sub string in Google Sheet script

The following will demonstrate how to get position of sub string in google sheet script. The position can be a single character or sub string.

In the following example, position of “@” character can be found using “indexof”

function stringIndexOfTest1(){
  var test_mail = "test@gmail.com";
  var pos = test_mail.indexOf('@');
  SpreadsheetApp.getUi().alert('indexOf method on a string in google sheet script '+ pos); 
}

 

About the author: Explore SARCS

You must be logged in to post a comment.