string

Regex for parsing .strings files

I need a PHP Regex that can parse .strings files. In particular, it needs to be able to handle comments, blank lines, escaped characters and angle brackets. Example of a .strings file: /* string one */ "StringOne"="\"1\""; "StringTwo"="<2>"; /* Bob Dillon */ "Bob"="Dillon"; By request, the desired output would be something such as:...

How do I create a string using a loop variable in MATLAB?

I have a loop like this: for i=1:no %some calculations fid = fopen('c:\\out.txt','wt'); %write something to the file fclose(fid); end I want data to be written to different files like this: for i=1, data is written to out1.txt for i=2, data is written to out2.txt for i=3, data is written to out3.txt etc. Doing 'out'+ i ...

LPSTR how to free memory after using

Hi Suppose i have a LPSTR variable. How do i free the memory after using the variable. Is it LPSTR szFileName = GetSBCSBuffer(sFilePath); // sFilePath is a CString delete szFileName; OR delete []szFileName; Kindly advise ...

Is there a tool to diff/merge/sort localizable strings files?

Localizable strings file which are used for Apple/iPhone apps localization have the following format: /* COMMENT */ "KEY" = "VALUE" Note that KEY is unique in a given strings file. COMMENT is optional however it can help the translator with some additional info. Example: /* Menu item to make the current document plain text */ "Make ...

Need to make full names in cakePHP

Hi all, If I have a person model with first_name and last_name, how do I create and display a full_name? I would like to display it at the top of my Edit and View views (i.e. "Edit Frank Luke") and other places. Simply dropping echoes to first_name and last_name isn't DRY. I'm sorry if this is a very simple question, but nothing has ...

How do I wrap long lines of text in a Java TextBox?

Hello! I want to load a text box in Java from a text file. This sounds simple but the big question is how to return at the end add newlines when text get close to the edge of the box, for example. | | | Java java java Java java java |Java java java...

Determine if string from argv[1] starts with a character or number (C-programming)

I'm writing a small application in C that takes two parameters. One is a filename, the other a number, and they may be specified in random order. ./main filename 12345 and ./main 12345 filename should both work. How can I easily determine which is which when I know the filename starts with a character? ...

Is there a Java utility which will convert a String path to use the correct File separator char?

I have developed a number of classes which manipulate files in Java. I am working on a Linux box, and have been blissfully typing new File("path/to/some/file");. When it came time to commit I realised some of the other developers on the project are using Windows. I would now like to call a method which can take in a String of the form "/...

Flex String to XML

I have a string in XML format and I want to use this string as flex XML type as following : This is my string : <Graph> <Node id="1" name="1" nodeColor="0x333333" nodeIcon="center" x="10" y="10" /> <Node id="2" name="2" nodeColor="0x333333" nodeIcon="center" x="10" y="10" /> <Node id="3" name="3" nodeColor="0x333333" nodeIcon=...

Convert Object to String iPhone SDK

Hello, I have got something strange: This Code does NOT Work: cell.imvstatus.image = [UIImage imageNamed:[[tutorials objectAtIndex:indexPath.row] objectForKey:@"image"] ]; This code works: cell.imvstatus.image = [UIImage imageNamed:@"ROR.png" ]; And in the object there is the value "ROR.png" Whats the problem at the above one? How c...

removing part of string UPDATED

www.powersource.se The last link, "Add some stuff" doesn't work properly. It's supposed to add a bit of text when you press it and then remove the text when you press it again. I've made the add-part work, but I haven't managed to make the remove-part. function add_module(title, text) { container = document.getElementById('text-main');...

robust string reverse

Hi, I am trying to code a trival interview question of reversing a string. This is my code: #include <string.h> char* rev( char* str) { int i,j,l; l = strlen(str); for(i=0,j=l-1; i<l/2 ; i++, j--) { str[i] = (str[i] + str[j]); str[j] = str[i] - str[j]; str[j] = str[i] - str[j]; } re...

Unexpected results using istringstream for string to double conversion in C++

I'm currently trying to take a string ("0.1") and convert it to a double using C++ in Xcode on 10.6 with gcc4.2. I'm using a function I pinched from another question, but when I try to use the function, my input according to gdb is (string)"0.1", but my output is (double)2.1220023981051542e-314. Here is my snippet copied straight out t...

Cost of operation in property if not accessed (String.Join)

Hello, I am creating (possible a lot) of objects as a result from a WDS query. I want them strongly typed, so I created a wrapper object which extracts the data from the oledbreader. The question is now, I want to do this for convinience: // Values with string[] return value public string[] System_Author { get; set; } publ...

C - Saving a Small File As a String

Hey guys...In C, I wish to read a file in my current working directory (nothing fancy), into a string. Later, I'd like to print that string out so I can do some work on it. I'm more used to Java, so I'm getting my chops on C and would love an explanation on how to do this! Thanks fellas... ...

How can I return a PChar from a DLL function to a VB6 application without risking crashes or memory leaks?

I have to create a DLL which is used by a VB6 application. This DLL has to provide several functions, some of them must return strings. This is the VB6 declaration: Declare Function MyProc Lib "mylib.dll" (ByVal Param As String) As String And this the Delphi implementation stub in mylib.dll: function MyProc(AParam: PChar): PChar; st...

C Strings Library

Is there a C strings library for C (not C++) that implements an abstraction over char * and wchar_t * strings? The requirements are: to be BSD/MIT/CDDL licenced implements some kind of reference count mechanism has support for regular expressions has Unicode support Thanks, ...

How to convert a GUID to a string in C#?

I'm new to C#. I know in vb.net, i can do this: Dim guid as string = System.Guid.NewGuid.ToString In C#, I'm trying to do String guid = System.Guid.NewGuid().ToString; but i get an "Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method?" error. ...

String Array Thing!

Right - to start with, I'm entering unfamiliar areas with this - so please be kind! I have a script that looks a little something like this: Private Function checkString(ByVal strIn As String) As String Dim astrWords As String() = New String() {"bak", "log", "dfd"} Dim strOut As String = "" Dim strWord As String For Eac...

How to Transform a String from Multi-Line to Single-Line in PHP?

Is there a PHP string function that transforms a multi-line string into a single-line string? I'm getting some data back from an API that contains multiple lines. For example: <p>Some Data</p> <p>Some more Data</p> <p>Even More Data</p> I assign that data to a variable, then echo the variable as part/"cell" of a CSV document. It's...