string

How can I create a cell of strings out of a meshgrid in MATLAB?

I have a library function that takes parameters as a text string (it's a general C library with a MATLAB frontend). I want to call it with a set of parameters like this: '-a 0 -b 1' '-a 0 -b 2' '-a 0 -b 3' '-a 1 -b 1' '-a 1 -b 2' '-a 1 -b 3' etc... I'm creating the values of a and b with meshgrid: [a,b] = meshgrid(0:5, 1:3); whic...

Regarding Object to Double java

I am getting an compilation error "not a statement" for the below code. Not sure what's wrong. inMax is a hasmap. tcharge is a string and it's a key. Is this one a valid statement? Double tMaxCharge= (Double)inMax.get(tCharge); ...

Dynamic String x Static String

Im creating a Windows Service and I want to put a dynamic path in the code. But it only accepts static code. This works: Process.Start("C:\\Program Files\\Program\\Program.exe", "-socket 12345"); But this doesnt: String path = "C:\\Program Files\\Program"; String programName = "\\Program.exe"; String fileLocation = path ...

Tinyxml to print attributes

I'm trying to get std::string from attribute's value with TinyXml. The only thing I can get is a const char * val, and I can't find any way to convert from const char * to a std::string. so two possible answers to that: 1. How to get a string of an attribute with TinyXml? 2. How to convert const char * val to string val. this is the co...

How to remove $_SERVER['DOCUMENT_ROOT'] from a given string in PHP

How can i remove $_SERVER['DOCUMENT_ROOT'] from a string like this /home/bla/test/pic/photo.jpg the result should look like this /test/pic/photo.jpg I also need to take the photo.jpg from /test/pic/photo.jpg How can i do that i PHP? Thank ...

C#: Caused error :having a string variable which its value contains & ?

hi EDIT: I have edited my post... Working on a project (c#), I have a string (password) within an XML file (app.config) which it value contains '&' character. Suppose it some thing like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="MainConnectionString" value="Data Source=MyData...

How to create HTML text from C# application?

I have C# application that must store some information into MS SQL that would be later sent to email with DB Mail. Within C# application I have a class with several properties and I need to use it to generate email text. So what I would like is set up a template with placeholders for variables. I need to create text as HTML and plain t...

Is returning a string literal address from a function safe and portable?

I need a function to return a string that will only be accessed read-only. The string contents is known at compile time so that I will use a string literal anyway. I can return something like std::string: std::string myFunction() { return "string"; } or return const char*: const char* myFunction() { return "string"; } Is the...

php, second last comma in a string to break string, or regex

I'm trying to find a way to break a string at the second last comma, for example: piece 1, piece 2, piece 3, piece 4, piece 5, piece 6, piece 7 should be 2 parts: piece 1, piece 2, piece 3, piece 4, piece 5 and piece 6, piece 7 and piece 1, piece 2, piece 3, piece 4, piece 5 should be: piece 1, piece 2, piece 3 and piece 4, piec...

Safely split/paginate an HTML String with ASP.NET

I have rendered one of my controls into a string. I want to safely split the html string. I don't want any hanging html tags. I am working on a pagination control adapter. How can I split my string, around less than a set number of chars) safely taking HTML into account? ...

C# string[] to int[]

Is there a way to convert string arrays to int arrays as easy as parsing an string to an int in C#. int a = int.Parse(”123”); int[] a = int.Parse(”123,456”.Split(’,’)); // this don't work. I have tried using extension methods for the int class to add this functionality myself but they don't become static. Any idea on how to do this f...

Java. Ignore accents when comparing strings

The problem it's easy. Is there any function in JAVA to compare two Strings and return true ignoring the accented chars? ie String x = "Joao"; String y = "João"; return that are equal. Thanks ...

What is the best alternative to calling strlen() in my for loop condition in C?

I've read that it is bad practice to call strlen() in my for loop condition, because this is an O(N) operation. However, when looking at alternatives I see two possible solutions: int len = strlen(somestring); for(int i = 0; i < len; i++) { } or... for(int i = 0; somestring[i] != '\0'; i++) { } Now, the second option seems...

What's the easiest way to get Dictionary functionality in VB.NET?

I want to statically define a mapped array of strings like: var dict = {cat:50, bat:10, rat:30}; and lookup values within it like: MessageBox.Show( dict["cat"] ) ...

jquery, string, find

HI, Can somebody help me with this : This is my HTML: <div class="Breadcrumb"> <a href="#">Home</a>&nbsp;&gt;&nbsp; <a href="#">Projects</a>&nbsp;&gt;&nbsp; Projects Text </div> I want to get with jQuery the string what is not in anchor tag , in this example is "Projects Text" Theoretically something ...

Remove special characters in string with Regexp- jQuery

Who can help me with regular expression , to remove some string with jquery, don't have much experience in regex <div class="test" > &nbsp;&gt;&nbsp;&nbsp;&gt;&nbsp;Test Text </div> I want to remove "&nbsp;&gt;&nbsp;&nbsp;&gt;&nbsp;" and to leave just the text Thanks!! ...

Oracle Query - Get only strings in the select field

Hi all! Maybe this sounds a little bit crazy, but I need to come up with a query to retrieve only letters out of an alphanumeric field. For example: TABLE 1234ADD 3901AC 1812OPA 82711AUU RESULTS EXPECTED ADD AC OPA AUU Thank you! ...

Compare 7 words to eachother to see if 5 of them are equal. How?

I have seven words in the array: string[7] = {x,x,x,x,x,x,x}; the x is generated from another array: string[4]={a,b,c,d}; that means each x can be either a or b or c or d. It is randomly generated. this could be an example: string[7]= {a,a,d,a,a,c,a} my question is how can I check if there are five x which has the same value?...

Converting to upper and lower case in Java

I want to convert the first character of a string to Uppercase and the rest of the characters to lowercase. How can I do it? Example: String inputval="ABCb" OR "a123BC_DET" or "aBcd" String outputval="Abcb" or "A123bc_det" or "Abcd" ...

How to put c++ string into char aray

If I have something like char name[10]; and I want to put the string s into name, where s = "joe" how would I do that? Also, can I make a function that takes strings as inputs, but treats those as char arrays? ...