Flex :: Determine If A String Contains A Specific Substring?
Apr 29, 2010Given a string A, how can I determine if that string contains the substring "video/x-flv"?
View 5 RepliesGiven a string A, how can I determine if that string contains the substring "video/x-flv"?
View 5 RepliesI have a string variable assigned with some Content in HTML format.[code]...
But in the output i am getting as This is <b. Basically it considering HTML related tags also as text. But my code has to omit the HTML tags while calculating sub string.
for example, how do i know that the "hello world" string contains three letter l?
View 2 RepliesDoes anyone know how to use string.substring to get a letter out of a string and get info from a variable of the name of that letter.
like->
text1="Kartik"
for(i=0;i<text1.length;i++){
[code]....
how to replace all the instances of '(A)' in a string with just 'A'.
This is what I have, but it is not working:
String str = "(A) + (B) + ( (A) + (B) )";
str = str.replace("(A)","A");
I'm trying to determine with the help of a mouse event if I'm over a specific component. So right now I have two components, let's say buttonA and buttonB. ButtonA has a listener on it already listening for the mouse out event. ButtonB is flush against the edge of ButtonA. I need to find out the code for it. Here is more details:
[Code]...
Ok perhaps ive bitten off too much here...I know you are not supposed to parse xml/html to regex but the thing is there just arent many other options.Im using AS3.im parsing the source of textflowlayout text to a different format.
string to parse :
< fontFamily=Verdana encoding=unicode fontWeight="bold"> some text < fontFamily=Verdana encoding=unicode > some text < fontFamily=Arial encoding=unicode fontStyle="italic"> some text < fontFamily=Arial encoding=unicode fontWeight="bold" fontStyle="italic"> some text
what i really need is:
< fontname=Verdanabold encoding=unicode> some text < fontname=Verdana encoding=unicode > some text < fontname=Arialitalic encoding=unicode > some text < fontname=Arialbolditalic encoding=unicode > some text
logically i think of it as taking apart the string into substrings
checking if there are fontWeight or fontStyle in the substring
if there is then appending the font name with the weight or style so so that the font name becomes font NameWeightStyle.then rebuilding the string.The font could be any font with variouse styles or weights..so far:
pattern = /<(.*?)>/gixsm;
var matches:Object = pattern.exec(str);
var finalstring:String = "";[code]...........
I am creating an searchbox for a tablet application. On entering any text the results appear below as a list. Now I want to change color of that part of the text that is there in searchbox.So which text control would allow me to do that. I found that RichText is one such control but Adobe recommends not to use it for mobileDevices.
View 1 RepliesI load strings from a mxl. Some of the strings are file paths and some of them are just normal strings. How I can to determine who is a file and who is a regular string?
View 3 RepliesI have a script that always returns iframe HTML back to flash. I was looking to get help on how to build some RegEx code to only find the URL. I would only like this substring so I can use it in another script.Here is the iframe code the I want to search for and return the substring:
HTML Code:
<iframe SCROLLING="no" id="myFr" style="width:660px; height:500px; border:0px; margin:0px; padding:0px; overflow:hidden" src="http://www.blabla.net/sdsdsd/?ut=wecsdsd&lang=EN"></iframe>
This is then best O could come up with but unfortunately.... it returns src=" too.
ActionScript Code:
private var _findTheURL:RegExp = /src=u0022(.*)u0022/i;
I want to set the clipboard to be a specific string. I've read about Flash's hack and the ability to hijack the clipboard + Adobe fixing this. I just wanted to know if I would have any problems if an end user has a Flash 10 player? What I could do with my solution is to simply pass in a variable via Flashvars + when a button I have on stage is clicked, will copy the Flashvars value to the clipboard:
System.setClipboard(myFlashVarVariable);
I just thought I'd ask anyway - the last thing I would want is something that worked perfectly in my environment that didn't work for all end users!
I have a dynamic text box called "tbNotes".I need to be able to see if the text box contains a website address. If it does contain a website address, I need to have a movieclip called "hilight" appear over that text.I have been messing around with this for a while but can't figure out how to search the text box to see if it contains "www." Then if it finds the "www." then make the "hilight" moviclip visible and start at the x position of the first w and the width end at the end of ".com".
View 1 RepliesI need to insert string in another string in specific index.
var str1:String = "A";
var str2:String = "LoremIpsum";
I need str2 to be "LoremAIpsum", insert str1 in index 5 in str2.
I'm making a little program that has to count specific characters in a string. Let's say the user inputs a name (I.e. "John Jabbadoo Jackson") and I need to count all the o's in the string. In this case it should be 4. How would the script look like?
View 2 RepliesI'm making a little program that has to count specific characters in a string. Let's say the user inputs a name (I.e. "John Jabbadoo Jackson") and I need to count all the o's in the string. In this case it should be 4.
View 2 Repliesso im trying to figure out regular expressions in Flex, but cant for the life of me figure out how to do the following.From the sample below, i need to extract out only "Mike_Mercury".So i have to somehow strip out everything around it with RegExp, or whatever's best. Also, I would need it to work with other samples as well. Im getting this from the reddit api, so id have to extract that same section from a whole bunch of these.
<table>
<tr>
<td>[code].............
Any way to change the specific character's colour within a string in a dynamic textfield. E.g.
String = "There can be only one"
I want all the o's to be orange...
I have a string whose length may vary but will always be divisible by 3 and want to push every three characters to an array.
e.g.
var myString = "000111000111";
//magic code converts
[code]......
I'd like to build a cipher in AS2, and I was wondering if there's any way for me to search a string for a specific letter/word?
Example:
someTextBox.text = "Lorem ipsum";
Can I search inside of that string for an "m" and then subsequently alter that letter?
Is there a possibility to tell flash, that he should ignore a piece of code out of an xml file.I'm asking this becouse our programmer generates dynamicly xml's.these contain a piece of code that makes that flash doesnt want to read our xml.Maybe I could tell flash to ignore this specific string?
View 1 RepliesI have the following as3 function below which converts normal html with links so that the links have 'event:' prepended so that I can catch them with a TextEvent listener.
protected function convertLinks(str:String):String
{
var p1:RegExp = /href|HREF="(.[^"]*)"/gs;
[Code]....
How can i modify my function so that links with 'event:' at the start are NOT matched and are left unchanged?
my objective is:
1.Read in a text file. e.g containing text like this, teacher/student/1/sn/2/3/4/5/9/f/tn/02/
2.pass it to a string.
3.then beable to extract different parts of the string and place them in different arrays.
The bit I dont know how to do is the extracting specific parts of the string? Is it possible to search for / and to treat what comes after it as a specific peice of information until the next / is read? Or perhaps there is a more efficient approach?
I have a String variable in my flex (flash builder 4) application containing CSV data. I need to allow the user to download this data to a local file. For example, giving them a "csv" button to click and it might present them with a save file dialog (and I would be sending the contents of my string variable).Is this possible / how ?I am using the ResuableFX component for the datagrid to csv. This the code I ended up with that works to save the string to a text file for the user (in a web browser):
var dg2CSV:DataGrid2CSV = new DataGrid2CSV();
dg2CSV.includeHeader=true;
dg2CSV.target=adgEncounters;
[code]......
I embed a text file into my Flex project and read its contents using code like this:
[Embed(source = "../../data/abc.txt", mimeType = "application/octet-stream")]
private var r_Abc:Class;
var xx:ByteArray = new r_Abc();
[code].....
Flex Effects include "isPlaying" property to check whether Effect is currently playing or not. But is there a way to find out what is the direction of playback (whether the play was started with playReversedFromEnd)?
View 1 RepliesWhen one call Clipboard.generalClipboard.getData() in ActionScript outside of Event.PASTE processing function it fails with following message. The Clipboard.generalClipboard object may only be read while processing a flash.events.Event.PASTE event. Even if I dispatch Event.PASTE event and call this function within event handler it still fails. How does it determine which event is currently being processed?
View 1 RepliesIs there a way to use some kind of encryption (md5, hash, etc...) to determine if two arraycollections are the same or not?
View 1 RepliesThere is event in spark Button - buttonDown. But how to determine the button up event?
View 1 RepliesHow do I determine if the HttpService instance timed out?
View 3 RepliesRef: spark.components.ButtonBar. In the spark ButtonBar's mouseOver event, how do you determine which of the several buttons the mouse is hovering over? There is, of course, no selected index at this juncture. If it makes a difference, my ButtonBar is not defined in MXML but is instantiated in ActionScript and an ArrayList is assigned to the dataProvider property of my ButtonBar instance.
View 2 Replies