string

How to declare strings in enum in C

Hello, typedef enum testCaseId { "TC-HIW-0019" = 0, "TC-HIW-0020", "TC-HIW-0021" } testCaseId; I need my test cases to be represented in enum. In my test function, I need to switch between the test cases like: void testfunc(uint8_t no) { switch(no) { case 0: case 1: default: ...

PHP: How can i convert an index to an string ?

Hi, how can i convert an index to an string ? For example i would like to get the 'signin' index here: array(1) { ["signin"]=> array(2) { ["email_address"]=> string(0) "" ["password"]=> string(0) "" } } Javi ...

Create all word variations of 2 character arrays

I have 2 collections of caracter string ex: List<string> one = new List<string>; one.Add("a"); one.Add("b"); one.Add("c"); List<string> two = new List<string>; two.Add("x"); two.Add("y"); two.Add("z"); What i would like to do is create a list of all the variations of words that can be created from this. But i only want to create 4 c...

How to delete a string inside a file (.txt) in Java Programming

I would like to delete a string or a line inside a ".txt" file (for example filen.txt). For example, I have these lines in the file: 1JUAN DELACRUZ 2jUan dela Cruz 3Juan Dela Cruz Then delete the 2nd line (2jUan dela Cruz), so the ".txt" file will look like: 1JUAN DELACRUZ 3Juan Dela Cruz How can I do this? ...

Failed to convert parameter value from a Guid to a String

Hello, I am at the end of my knowledge and googled for the answer too but no luck :/ Week ago everything worked well. I did a revert on the repository, recreated the tableadapter etc... nothing helped. When I try to save in my application I get an SystemInvalidCastException at this point: PersonListDataSet.cs: partial class P_Group...

PHP - How to remove the first number in a string?

Hello. How can I remove the first number in a string? Say if I had these 48 numbers seperated with a ',' (comma): 8,5,8,10,15,20,27,25,60,31,25,39,25,31,26,28,80,28,27,31,27,29,26,35,8,5,8,10,15,20,27,25,60,31,25,39,25,31,26,28,80,28,27,31,27,29,26,35 How would I remove the "8," from the string? Thanks. ...

Can I free memory passed to SysAllocString?

When allocating a new BSTR with SysAllocString via a wchar_t* on the heap, should I then free the original wchar_t* on the heap? So is this the right way? wchar_t *hs = new wchar_t[20]; // load some wchar's into hs... BSTR bs = SysAllocString(hs); delete[] hs; Am I supposed to call delete here to free up the memory? Or was that memo...

Simple/Direct/Heredoc way of constructing a HTML string in Java

In python I can construct a HTML string without worrying about escaping special characters like < or " by simply enclosing the string in triple quotes like: html_string = """ <html> <body> <p>My text with "quotes" and whatnot!<p> </body> </html> """ Is there a similar way to do this in Java? ...

what is regular expression not generated over {a,b}?

Hello all, I am really stuck with these 2 question for over 2 days now. trying to figure out what the question means.... my tutor is out of town too.... write a regular expression for the only strings that are not generated over {a,b} by the expression: (a+b)*a(a+b)*. explain your reasoning. and i tried the second question, do you thi...

.Net - Join together all item of a list in a output string

How can I write a Linq expression (or anything else) that select item from a List and join them together ? Example IList<string> data = new List<string>(); data.Add("MyData1"); data.Add("MyData2"); string result = //some linq query... I try data.Select(x => x + ","); //result = "MyData1, MyData2" ...

String Manipulation in Bash . . . Removing leading section

This is probably a really stupid question...but how can I remove parts of a string up to a certain character? Ex.) If I have the string testFile.txt.1 and testFile.txt.12345 how can I remove the 1 and 12345? Thanks a lot for the help EDIT: Sorry it was really unclear. I meant to remove and throw away the first part of a string up to a...

how to get the last char of a string in PHP?

I need to get the last character of a string. Say I have "testers" as input string and I want the result to be "s". how can I do that in PHP? ...

Is there a shorthand way to denullify a string in C#?

Is there a shorthand way to denullify a string in C#? It would be the equivalent of (if 'x' is a string): string y = x == null ? "" : x; I guess I'm hoping there's some operator that would work something like: string y = #x; Wishful thinking, huh? The closest I've got so far is an extension method on the string class: public sta...

How to prefix a positive number with plus sign in PHP

I need to design a function to return negative numbers unchanged but should add a + sign at the start of the number if its already no present. Example: Input Output ---------------- +1 +1 1 +1 -1 -1 It will get only numeric input. function formatNum($num) { # something here..perhaps a regex? } This f...

Merging two Regular Expressions to Truncate Words in Strings

I'm trying to come up with the following function that truncates string to whole words (if possible, otherwise it should truncate to chars): function Text_Truncate($string, $limit, $more = '...') { $string = trim(html_entity_decode($string, ENT_QUOTES, 'UTF-8')); if (strlen(utf8_decode($string)) > $limit) { $string ...

Advice on String Similarity Metrics (Java). Distance, sounds like or combo?

Hello, A part of a process requires to apply String Similarity Algorithms. The results of this process will be stored and produce lets say SS_Dataset. Based on this Dataset, further decisions will have to be made. My questions are: Should i apply one or more string similarity algorithms to produce SS_Dataset ? Any comparisons...

String cannot contain any part of another string .NET 2.0

I'm looking for a simple way to discern if a string contains any part of another string (be that regex, built in function I don't know about, etc...). For Example: string a = "unicorn"; string b = "cornholio"; string c = "ornament"; string d = "elephant"; if (a <comparison> b) { // match found ("corn" from 'unicorn' matched "corn"...

Java String.indexOf and empty Strings

I'm curious why the String.indexOf is returning a 0 (instead of -1) when asking for the index of an empty string within a string. The Javadocs only say this method returns the index in this string of the specified string, -1 if the string isn't found. To me this behavior seems highly unexpected, I would have expected a -1. Any ideas w...

How to eliminate a prefix of '0' before a number using jquery

I need a jquery script section that checks to see if the first digit of a textbox entered number string is a '0' and eliminate it if so. For example "044055" needs to become "44055" ...

string in c++,question

Hi, I created a program in C++ that remove commas (') from a given integer. i.e. 2,00,00 would return 20000. I am not using any new space. Here is the program i created void removeCommas(string& str1,int len) { int j=0; for(int i=0;i<len;i++) { if(str1[i] == ',') continue; else { str1[j] =str1[i]; j+...