Skip to main content
Known Participant
September 2, 2013
Question

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

  • September 2, 2013
  • 2 replies
  • 1346 views

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

This topic has been closed for replies.

2 replies

Andreas Jansson
Inspiring
September 2, 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') )

Vamitul
Legend
September 2, 2013

use a regex:

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

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

Known Participant
September 3, 2013

Thank u so much..Its working.