anybody know how to do a substring function in actionscript pls help~!! I want to do something like extact the number out and convert it to string!
3 5501
anybody know how to do a substring function in actionscript pls help~!! I want to do something like extact the number out and convert it to string!
Yes, with the substring method: -
var myStr:String = "Hello world";
-
var mySubstr:String = myStr.substring(6,11);
-
trace(mySubstr); // outputs: world
-
The following example shows what happens if a negative start parameter is used: -
var myStr:String = "Hello world";
-
var mySubstr:String = myStr.substring(-5,5);
-
trace(mySubstr); // outputs: Hello
-
Yes, with the substring method: -
var myStr:String = "Hello world";
-
var mySubstr:String = myStr.substring(6,11);
-
trace(mySubstr); // outputs: world
-
The following example shows what happens if a negative start parameter is used: -
var myStr:String = "Hello world";
-
var mySubstr:String = myStr.substring(-5,5);
-
trace(mySubstr); // outputs: Hello
-
thx for replying mind if I ask substring(6,11) ; 6 stand for ? and the 11 stand for?
thx for replying mind if I ask substring(6,11) ; 6 stand for ? and the 11 stand for?
yes, sorry, I forgot to explain, the method has two parameners, start and end
substring(start , end)
the start parameter is the parameter from which the method will start getting the characters, and the end param is up to which character will get.
if you pass a nevgative value as the start param, it will start counting the start from the last position minus the negative start parameter up to the end parameter. So if you do this: -
var myStr:String = "Hello world";
-
var mySubstr:String = myStr.substring(-5,5);
-
mySubstr will now have a value of "world". It is, in this case, the same as this: -
var myStr:String = "Hello world";
-
var mySubstr:String = myStr.substring(6,11);
-
In both of these examples mySubstr will have a value of "world";
If there's anything you didn't understand, please let me know.
Kind regards
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Radhika Sambamurti |
last post by:
Hi,
I've written a substring function.
The prototype is: int substr(char s1, char s2)
Returns 1 if s2 is a substring of s1, else it returns 0.
I have written this program, but Im sure there is an easier way to do this. I am hoping someone can point me to a more elegant way of writing this same function.
//// code follows ///////////
//implement a substring function, where if string2 is a sub of string 1, then the value returned is 1...
|
by: Jupiter |
last post by:
Hey,
I would like to know 2 things.
1)Is there any function (in C standard library) that extracts a
substring from a string?
2)Is there any function (in C standard library) that returns the
position of a substring in a string?
Thx a lot...
|
by: becte |
last post by:
I am little bit confused
Is this a legal way of removing a substring
from a string? What about the second alternative
using strcpy, is it ok even though the source and
dest. strings overlap?
// Remove (first occurence of) sub from src
void func(char *src, char *sub)
{
char *p;
|
by: Darren Anderson |
last post by:
I have a function that I've tried using in an if then statement and I've
found that no matter how much reworking I do with the code, the expected
result is incorrect.
the code:
If Not (strIn.Substring(410, 10).Trim = "") Then
'Something processed
Else
'Something processed
|
by: David Filion |
last post by:
Hi,
I have a question about substring(), when I run the following query:
prepaid=# select substring('15148300', 0, 5);
substring
-----------
1514
(1 row)
| |
by: Ajay |
last post by:
Hi all,Could anybody tell me the most efficient method to find a substr
in a string.
|
by: Badass Scotsman |
last post by:
Hello,
Using VB and ASP,NET I would like to be able to search a STRING for a
smaller STRING within, based on the characters which appear before and
after.
For example:
String1 = " That was a tasty burger"
|
by: kellygreer1 |
last post by:
What is a good one line method for doing a "length safe"
String.Substring?
The VB classes offer up the old Left function so that
string s = Microsoft.VisualBasic.Left("kelly",200)
// s will = "kelly" with no error
// but
string s2 = "kelly".Substring(0,200)
// results in
// ArgumentOutOfRangeException
|
by: jknaty |
last post by:
I'm trying to create a function that splits up a column by spaces, and
I thought creating a function that finds the spaces with CHARINDEX and
then SUBSTRING on those values would an approach. I get an error
saying that the I have an Invalid column 'Course_Number'. Not sure
why but I am very new to User Defined Functions. Here is what I have
so far:
CREATE FUNCTION CourseEvalBreakdown
(
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |