Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to check whether it is a character or a number using javascript..?

New Here ,
Sep 02, 2013 Sep 02, 2013

Hi,

In InDesign document,i have one cell value like this,Testvalue..,value122...............

From that,i want to remove only the dotted lines at the end of text.how to check whether it is a character or a number using javascript..?

kindly help me..

Thanks in advance..!

Vimala L

TOPICS
Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 02, 2013 Sep 02, 2013

use a regex:

http://www.javascriptkit.com/jsref/string.shtml

for example: myString.replace(/(\d+)\.+$/,"$1")

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 02, 2013 Sep 02, 2013
LATEST

Thank u so much..Its working.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 02, 2013 Sep 02, 2013

There is also a simple internal javascript function called isNaN(), meaning "is not a number".

It returns true (or -1) for non numeric values, and false (0) for numbers.

A decimal point inside a number is accepted as a number (for example "0.1"). isNaN is not locale dependant meaning that in countries using comma for decimal marker, we still get true from testing a value such as isNaN('0,1') )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines