Questions tagged "string" (page No.1)

Dynamically Invoke Property in AS3

I would like to dynamically invoke a Class's Property via a String. In the following code, I can dynamically invoke a Class's Function via a String. var myClass:Class = getDefinitionByName("myPackage.MyClass") as Class; myClass["myStaticMethod"](); where MyClass is defined as: package myPackage { public class MyClass { ...

How to split a multi-line string containing the characters "\n" into an array of strings in bash?

I have a string in the following format: I'm\nNed\nNederlander I'm\nLucky\nDay I'm\nDusty\nBottoms I would like to move this to an array of strings line by line such that: > echo "${ARRAY[0]}" I'm\nNed\nNederlander > echo "${ARRAY[1]}" I'm\nLucky\nDay > echo "${ARRAY[2]}" I'm\nDusty\nBottoms However, I'm running into problems with the "\n" characters within the string itself. They are represented in the string as two ...

Extracting a Part of a Hex-encoded String

Given the string: aa0a051c1400, how would I go about extracting just 05 or the 1c? I'm reading serial responses and I need to examine fragments of hex data to decipher what how much data is coming down the pipe after this initial data packet. ...

Scanning a Text File Line by Line in PHP

So I have been working recently on a questionnaire script in php and I wrote a tool that would output a single txt file with a list of questions, each on it's own line. The file would look like so.. 1 "Shopping for items is very important to me.." 2 3 ...

Java: Mask formatting strings

I would like to know how to format a string into a specified pattern in Java. For example: the source string: 01021234 the desired ouput: 01/02/1234 I have followed the MaskFormatter rabit hole, but its proven futile. Could someone clue me in on what function I should be using? Any help is greatly ...

perl interpolate code

I know in perl you can interpolate scalars by simply doing this: "This is my $string" However, I'm wondering if there is a way where I can interpolate actual perl code to be evaluated? An idea of what I want can be seen with ruby strings: "5 + 4 = #{5 + 4}" And ...

Replace space(x0020) from string in Regex C#

I am not good at Regex, and I think I am close. I have some data coming back from a list and populating a dropdown. I am getting x0200 representation instead of a space. I have tried Regex, but I think I am wrong here. foreach (string field in ...

Given the package, class, function(s), and parameters in Strings, how can I dynamically invoke a function in AS3?

I need to send requests between two separate .swfs, A and B. I have an interface, IRequest with the following methods: public interface IRequest { function get packagePath():String; function get className():String; function get functions():Vector.<String>; function get parameters():Array; ...

Why is fgets() and strncmp() not working in this C code for string comparison?

This is a very fun problem I am running into. I did a lot of searching on stack overflow and found others had some similar problems. So I wrote my code accordingly. I originally had fscan() and strcmp(), but that completely bombed on me. So other posts suggested fgets() and ...

String arrays output

How can I get the output of this program to work correctly? I'm not sure why the string array won't store my values and then output them at the end of my program. Thanks. #include <iostream> #include <string> using namespace std; int main () { int score[100], score1 = -1; ...

Making string to object?

I'm having a problem when converting a string to an object. Here is the function: public function slikepoid($dire,$id) { $this->dire=$dire; $this->id=$id; $slike = $this->skupljanjeslika($this->dire); $slikeid = array_filter($slike, function($el) { return substr( $el, ...

Finding a string with double quotes

I want this line of code to work- int start = s.IndexOf(""_type": "Person""name": ""); But clearly the double quotes are messing up the search... Any ideas about how to get this working? ...

Get the word after a particular word in a Ruby string?

How do I get the word after a particular word in a Ruby string? For example: From:Ysxrb<abc@gmail.com>\nTo: <xyzn@gmail.com>Subject: xyzabc\nDate: Tue, 19 Jun 2012 03:26:56 -0700\nMessage-ID: <9D.A1.02635.ABB40EF4@ecout1> I just want to get: Ysxrb<abc@gmail.com xyzabc ...

JavaScript/RegExp replace portion of string

I have a string something like: foo title:2012-01-01 bar Where I need to get the 'title:2012-01-01' and replace the date part '2012-01-01' to a special format. I just am not good at RegExp and currently have: 'foo from:2012-01-01 bar'.replace(/from:([a-z0-9-]+)/i, function() { console.log(arguments); return 'replaced'; }) and that returns foo replaced ...

ParseInt NumberFormatException on phone number

I'm getting the following error when trying to parse the phone number, "5554567899" java.lang.NumberFormatException: For input string: "5554567899" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:495) at java.lang.Integer.parseInt(Integer.java:527) ... Obviously, the phone number is able to be parsed. I even referenced this question, and the byte code result was 53,53,53,52,53,54,55,56,57,57, So there's no invisible characters in the string. I'm ...

How to preview certain amount of Characters/Words of a Blog post?

I am using Linq to Sql with a ListView to show Blog posts on a Blog page. I can cut it down to 500 characters using SubString like the code below, but this does not solve the issue. The post will contain HTML tags, so cutting it off ...

Javascript - kill white space in front of string

I making some server reguests and the server reply me with a string that has a lot of spaces in front of the string. the string is USERNAME EXIST I know how to use this: String.prototype.killWhiteSpace = function() { return this.replace(/\s/g, '');}; String.prototype.reduceWhiteSpace = function() { return this.replace(/\s+/g, ' ');}; but the first the first answer ...

Jquery/PunBB Replace Number with String

Using PunBB on Forumotion the idea was to use the Points system to replace the number of points displayed with a string of text. Using a span class I first defined a class 'honorpoints' around the code that shows the number of points a user has. <span class="honorpoints"><!-- BEGIN profile_field -->{postrow.displayed.profile_field.CONTENT}<!-- ...

« Previous12345678910 ... 13191320Next »Show All