TravelingAdMan
TravelingAdMan

Reputation: 179

AS2 Remove the Last 11 Characters from a Variable ActionScript 2

How do I go about removing the last 11 characters from a variable in ActionScript 2? I'm trying to delete the last 11 characters from a variable that contains a date from a twitter XML feed so that the variable goes from "Tue Jun 07 03:15:15 +0000 2011" to "Tue Jun 07 03:15:15"

Upvotes: 1

Views: 978

Answers (1)

DigitalD
DigitalD

Reputation: 586

use substr method of the String object:

var dateString:String="Tue Jun 07 03:15:15 +0000 2011";
var resultString:String=dateString.substr(0, dateString.length-11);
trace(resultString);

Upvotes: 4

Related Questions