string

C# Convert Byte Array with nulls to string

All, I have a question about converting byte arrays with nulls to C# string. Here is an example of my byte array that I would like to convert to string. I expect to get a string with value SHKV [0]: 83 [1]: 0 [2]: 72 [3]: 0 [4]: 75 [5]: 0 [6]: 86 [7]: 0 How can I do it in C# ? Thanks, MK ...

Why do the characters ÌÌÌÌ get stuck onto the begining of my strings?

Hello I have been developing some computer vision tools with openCV, but every time that I pass a string into an openCV function, the characters ÌÌÌÌ get tagged onto the beginning. At first this was just annoying, but now I am trying to use openCV's fileStorage tools and the ÌÌÌÌ characters are making my file names unreadable. Note: th...

In Python, are single character strings guaranteed to be identical?

The title really says it all. I read somewhere (an SO post, I think, and probably somewhere else, too), that Python automatically references single character strings, so not only does 'a' == 'a', but 'a' is 'a'. However, I can't remember reading if this is guaranteed behavior in Python, or is it just implementation specific? Bonus poi...

Delphi Assembly Function Returning a Long String

I am trying to learn inline assembly programming in Delphi, and to this end I have found this article highly helpful. Now I wish to write an assembly function returning a long string, specifically an AnsiString (for simplicity). I have written function myfunc: AnsiString; asm // eax = @result mov edx, 3 mov ecx, 1252 call Syste...

How can I do case insensitive string search with Linq and SQL Server?

Here is my current code for searching tags: public JsonResult TagSearch(string term) { if (term == null || term == "") return Json(""); var tags = (from t in _session.All<Tag>() where t.Name.Contains(term) select t.Name).Take(6).ToArray(); return Json(tags); } How could I do case insensiti...

How do I do this replace regex in python?

Given a string of text, in Python: s = "(((((hi abc )))))))" s = "***(((((hi abc ***&&&&" How do I replace all non-alphabetic symbols that occur more than 3 times...as blank string For all the above, the result should be: hi abc ...

Sending Delphi string as a parameter to DLL

Hi. I want to call a dll function in Delphi 2010. This function take a string and write it to a printer with USB interface. I do not know in which language the dll is developed with. According to the documentation the syntax of the function is: int WriteUSB(PBYTE pBuffer,DWORD nNumberOfBytesToWrite); How can I declare and use my func...

Extracting number ID from a URL in Javascript

Similar to my previous question: http://stackoverflow.com/questions/3300433/spliting-a-string-in-javascript The URLs have now changed and the unique number ID is no longer at the end of the URL like so: /MarketUpdate/Pricing/9352730/Report How would i extract the number from this now i cannot use the previous solution? ...

PHP String Function

Simply put, I have a string with a prefix "msg" followed by some numbers that serve as the ID for a list item e.g. <li id="msg1"></li>..............<li id="msg1234567890"></li> What is the most efficient way to grab just the numbers? In VB, I'd do the following: str = "msg1" str = right(str,len(str)-3) How would I do something ...

PHP - single quotes or double quotes for variable concatenation?

Is it better to concatenate a variable (say, $name) into an existing string (say, $string) like this: $string='Hi, my name is '.$name or like this: $string="Hi, my name is $name"; or like this: $string=sprintf("Hi, my name is %s",$name); in terms of processor time/efficiency. ...

Save the File in a single text file and also in the path i specified.

Hi all i have done a code to save my file as follows if (m_strStandardEntryClassCode == "PPD") { m_strPath += "/PPD_BatchHeader_" + m_strDate + ".txt"; } else { m_strPath += "/CCD_BatchHeader_" + m_strDate + ".txt"; } using (TextWriter tw = new StreamWriter(m...

How to convert array string to array in php

Hi, I have a string, which is comes from js using encodeURICompoent(). Now i would like to convert this string into array. I tried my level best to solve this. But i couldn't find any solution to do this. Any help greatly appreciated. array string = 'array(0=>array("packid"=>22,"pverid"=>18,"yaml"=>"- url: /static static_dir: static ...

' " ' and " ' " in Java .. How to deal with them ?

I'm writing this in JAVA : stmt.executeQuery("SELECT * FROM mytable INTO OUTFILE '/tmp/mytable.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' ;"); This is has to be written between " " as show because It has to be a String. However, when I run the code it says "Unclosed String and Cha...

How to compare managed and unmanaged Strings?

I have an application that uses managed System::String in the UI elements, but then refers to un-managed (read: legacy) code for the more complex computation. Additionally, there is not a consistent encoding for the strings - managed strings can be either regular "strings" or Unicode L"strings" and un-managed strings come in all of char...

Splitting a changing string with perl

I have a bunch of strings in perl that all look like this: 10 NE HARRISBURG 4 E HASWELL 2 SE OAKLEY 6 SE REDBIRD PROVO 6 W EADS 21 N HARRISON What I am needing to do is remove the numbers and the letters from before the city names. The problem I am having is that it varies a lot from city to city. The data is almost never the same. Is...

How do I divide a complex string into 3 seperate arrays?

Here's where I am: I started with an array...cleaned it up using 'regex'. Now I have this...each item has three values mystring = 4|black|cat, 7|red|dog, 12|blue|fish Here's where I want to be: I want to end up with three arrays. array1=("4","7","12") array2=("black","red","blue") array3=("cat","dog","fish") I also want to do thi...

jquery reconstructing a selector from a string

I am taking the value of a select element and trying to modify it so that I can have access to the onscreen preview element that the select item represents. Here is the first part of the code... $("#single_area_select").change(function(){ var $element = '#preview_' + $("#single_area_select").val().toLowerCase(); elementC...

Should I use string.isEmpty() or "".equals(string)?

The title basically says it all. I'm usually testing this alongside a string == null, so I'm not really concerned about a null-safe test. Which should I use? String s = /* whatever */; ... if (s == null || "".equals(s)) { // handle some edge case here } or if (s == null || s.isEmpty()) { // handle some edge case here } On t...

Getting a line count woes UITextView

Hi, am being driven crazy trying to obtain how many lines a string will require as entered in a UITextView. The code below for some reason does not split the string supplied over lines and returns a stringSize = (o, 32) WTF? I enter a crazy long string that is way past 320 but still no expected result? NSString *t = @"in my app this s...

mySql input string was not in a correct format

I've done Microsoft SQL server for years.. but just today tried MySql. The question is with vb.net trying to do a save to MySql. The stored proc looks like this. DROP PROCEDURE IF EXISTS test.spAgency_Save; create procedure spAgency_Save (IN p_intTblAgencyID INT, IN p_vcAgency varchar(20),IN p_dtmDate datetime, OUT p_Output INT) begin...