string

How can I modify the value of a string defined in a struct?

Hi, Based on your comments, let me modified the original question... I want to create a struct with size of 4kb (this size is a requirement so I have to meet it). The problem was that I couldn't modify the value of the string variable contained in the struct because the compiler throws a segmentation fault. Currently, if I use a pointe...

Global String in Installshield

I am trying to do have a global string in Installshield so I can access it in multiple places. This is my first run at scripting in it. Here is what I have: STRING DIR; .... DIR="c:\\tempdir"; function Completed_Action() begin // Here is where I try to access the DIR string. It keeps giving me errors though. Is there any way ...

Parse int to string with stringstream

Well! I feel really stupid for this question, and I wholly don't mind if I get downvoted for this, but I guess I wouldn't be posting this if I had not at least made an earnest attempt at looking for the solution. I'm currently working on Euler Problem 4, finding the largest palindromic number of two three-digit numbers [100..999]. As...

Javascript field value lenght

Hi guys, I'm doing something like this: alert(document.getElementById('cardNumber').value); And it alerts cardNumber value. But I need in it's lenght: alert(document.getElementById('cardNumber').value.lenght); undefined Why? ...

MSTest project can't get localized string?

I ran into a strange problem. In my unit test, I want to check the localized strings. However, I can't seem to get it work. For example, I created two resources: Resource1.resx for English and Resource1.zh-CN.resx for Chinese. The unit test project can only get the (default?) English resource string. This is the code I'm using: Resource...

Alternate way for string replace and array

Is there any way to replace titles faster then str_replace function? I've got a file that is 2000 lines of array changes. That hurts my webpage. ...

How to parse out html links from a huge string with html links and other text (Java).

Hello, my question is how would i be able to go through a string and take out only the links and erase all the rest? I thought about using some type of delimiter, but wouldn't know how to go about using it in Java. an example of what i am trying to do: this is my String: String myString = "The file is http: // www. .com/hello.txt a...

Declaring a string array in class header file - compiler thinks string is variable name?

Hey everybody, I need a bit of a hand with declaring a string array in my class header file in C++. atm it looks like this: //Maze.h #include <string> class Maze { GLfloat mazeSize, mazeX, mazeY, mazeZ; string* mazeLayout; public: Maze ( ); void render(); }; and the constructor looks like this: //Maze.cpp #include...

Delphi - Clean TListBox Items

I want to clean a list box by checking it against two other list boxes. Listbox1 would have the big list of items Listbox2 would have words I want removed from listbox1 Listbox3 would have mandatory words that have to exist for it to remain in listbox1 Below is the code I've got so far for this, it's VERY slow with large lists. //...

Storing Shell Output

Hello everybody, I am trying to read the output of a shell command into a string buffer, the reading and adding the values is ok except for the fact that the added values are every second line in the shell output. for example, I have 10 rows od shell output and this code only stores the 1, 3, 5, 7, 9, row . Can anyone point out why i am...

Turn value from SQL into PHP

Let's say I have saved this kind of data (some text '.date(d).' some text) to SQL (with htmlspecialchars()). Now, if I restore htmlspecialchars, is there a way for me to have PHP fill in the date? Basically I guess what I'm asking is, is there way to turn text into php string? ...

Printing a string and variable in MIPS

Here's the C representation of what I'm trying to do in MIPS assembly: printf ("x=%d\n", x); I know that I can do a syscall to easily print x= and I can also do a syscall to print the int x (which is stored in a register). However, that prints them like this (let's say x is 5): x= 5 How can I make them print on the same l...

Algorithm to see if keywords exist inside a string

Let's say I have a set of keywords in an array {"olympics", "sports tennis best", "tennis", "tennis rules"} I then have a large list (up to 50 at a time) of strings (or actually tweets), so they are a max of 140 characters. I want to look at each string and see what keywords are present there. In the case where a keyword is composed o...

Beginner C++ Question

I have followed the code example here toupper c++ example And implemented it in my own code as follows void CharString::MakeUpper() { char* str[strlen(m_pString)]; int i=0; str[strlen(m_pString)]=m_pString; char* c; while (str[i]) { c=str[i]; putchar (toupper(c)); i++; } } But this gives me the following compiler...

How can I detect if a string contains punctuation marks at the end?

Lets assume I have the string: "Hello I like your shoes #today...!" I am tokenizing the string by spaces: return [string componentsSeparatedByString:@" "]; So my array contains: Hello I like your shoes #today...! I want to focus on "#today...!" any word that has a # in the prefix I am changing the font color. How can I make sur...

how can i store more than just one letter in a variable?

with char i get this error: .\main.cpp(6) : error C2015: too many characters in constant ...

Removing trailing newline character from fgets() input

i am trying to get some data from the user and send it to another function in gcc. the code is something like this. printf("Enter your Name: "); if(!(fgets(Name, sizeof Name, stdin) != NULL)) { fprintf(stderr, "Error reading Name.\n"); exit(1); } However, i find that it has an \n character in the end. so if i e...

PHP - print content from file after manipulation

Hello there, I'm struggling trying to read a php file inside a php and do some manipulation..after that have the content as a string, but when I try to output that with echo or print all the php tags are literally included on the file. so here is my code: function compilePage($page,$path){ $contents = array(); $menu = getMenuFor(...

Parsing a string

i have a string of the format "ABCDEFG,12:34:56:78:90:11". i want to separate these two values that are separated by commas into two different strings. how do i do that in gcc using c language. ...

Convert a list of strings [ '3', '1' , '2'] to a list of sorted integers [ 1, 2, 3]

I have: L1 = ['11', '10', '13', '12', '15', '14', '1', '3', '2', '5', '4', '7', '6', '9', '8'] this is a list of strings, right? I need to make it a list of integers as follows: L2 = [11, 10, 13, 12, 15, 14, 1, 3, 2, 5, 4, 7, 6, 9, 8] finally I will sort it like below: L3 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] by L2.sort() please let ...