Thursday, November 23, 2017

Find "\" Special Character in String with Occurances - JavaScript

Hi All,

Please find the code below to identify Special Character in a String.

var valuewithSpecialCharacter ="yourname\name"
var findSpecialCharacterinDomainName = 0;

    for (i = 0; i <= valuewithSpecialCharacter.length; i++) {
        if (/^[a-zA-Z]+$/.test(valuewithSpecialCharacter[i])) {
            findSpecialCharacterinDomainName += 1;
        } else {
            break;
        }
    }

Note:

You will get Output Count findSpecialCharacterinDomainName.


No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...