Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Javascript help
Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Thuged_Out_G




PostPosted: Sat Mar 18, 2006 3:43 am   Post subject: Javascript help

what im trying to do is run a string through a function, that will remove all comma's from the string
Also, is there is a way after the string has been stripped of all comma's to change it to an int
similar to turing's strint command

here is what i have come up with so far

code:

function check(var1) {
var comma=new Array[var1.lastIndexOf(",")]
for(i=0;i<=comma.length;i++) {
comma[i]=var1.indexOf(",", i)
}

for(i=0;i<=comma.length;i++) {
var1.substring(comma[i], comma[i] + 1)
}
alert(var1)
}


any help would be appreciated.
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: Wed Mar 22, 2006 12:43 am   Post subject: (No subject)

looks like i was realy far off with this problem

code:

var1.split(",").join("")


that did it quite easily
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: