string

MIPs Assembly Pig Latin

In my MIPs Assembly Programming class I've been tasked with writing a program that converts a string into simplified pig latin. Simplified pig latin assumes all words in the string are at least 2 characters long, and every word has its first letter shifted to the end followed by "ay". Also, assume there are no punctuation marks of any k...

Is there a getElementsByTagName() like function for javascript string variables?

I can use the getElementsByTagName() function to get a collection of elements from an element in a web page. I would like to be able to use a similar function on the contents of a javascript string variable instead of the contents of a DOM element. How do I do this? EDIT I can do this by creating an element on the fly. var myElement...

Capitalise every word of a string in PHP?

As I know, strtolower makes the string all lowercase and ucfirst makes the string's first letter capitalised. I am asking, is it possible to make every word within the string capitalised? Example $string = "hello world" - How can I make this appear "Hello World"? ...

how the subString() function of string class works

Hi please see the following code. String s = "Monday"; if(s.subString(0,3).equals("Mon"){} String s2 = new String(s.subString(0,3)); String s3 = s.subString(0,3); I know that line 2 will still point to "Monday" and have a new String object with the offset and count set to 0,3. The line 4 will create a new String "Mon" in string poo...

Why can't I leverage 4GB of RAM in my computer to process less than 2GB of information in C#?

Scenario: over 1.5GB of text and csv files that I need to process mathematically. I tried using SQL Server Express, but loading the information, even with BULK import takes a very long time, and ideally I need to have the entire data set in memory, to reduce hard disk IO. There are over 120,000,000 records, but even when I attempt to fi...

I am trying to return a Character Array but i'm only getting the first letter!

I'm working on a small little thing here for school. After hours of researching, and a ton of errors and logic reworking I've almost completed my little program here. I'm trying to take user input, store it into the string, get a character array from the string ( dont ask why, I just have to put this into a character array ), then get t...

Adding an echo with a string in PHP?

Hello, I have an echo = "000000" and a string named $id which is an integer. If $id is = 1, how do I add "000000" + $id to get 000001 ? ...

Testing Bits To Create A String - Is there a better approach?

This code works, but I'm wondering if there is a better way to do it. Basically I need to test bits, and write the appropriate character or characters to a string depending on the state of the bit. The spaces are present because the characters will be displayed with a fixed width font and I'd like to keep them from moving around. C or...

Why does the compiler require convoluted syntax for this?

Or, "am I doing it wrong"? I am writing a small function that will return a string, quoted (as quoted-printable) if necessary, otherwise it returns it as is. A character is input into the function; the result is a string. What I tried to do at first was: private string QuotedChar(char ch) { if(ch < (char)128 && !char.IsWhiteSpace...

How do I copy a two dimensional array of strings?

EDIT: ah, there it is! Problem solved, thank you! (Bug was elsewhere, not in the copy function.) I'm working with a program that uses two-dimensional arrays of Strings (probably not that smart to begin with, but eh), and I'd like to write a function that takes one of these arrays (let's say array1), makes an independent copy, and retur...

Why VC++ Strings are not reference counted?

STL standard do not require from std::string to be refcounted. But in fact most of C++ implementations provide refcounted, copy-on-write strings, allowing you passing string by value as a primitive type. Also these implementations (at least g++) use atomic operations making these string lock-free and thread safe. Easy test shows copy-on...

How to sort 32bit numbers to find unique entries?

Hi, There is a data set of "file" - name of file, and 32bit number is following after it - something like hash for the file. "file1" 6a9bd9a6 1df3b24b 7ab054dc "file2" 6a9bd54e 1df3b24b 8cd054dc "file3" 6a9bd9a6 7ab054dc How am I going to get unique files so s2 is not a prefix of any other s2 - that means the number is unique. If the...

Separate Connection String For Different Environments

In my VB.NET windows application code I created my own AppConfig class that holds the connection string to a SQL server database. I am about to move this program into production and was wondering if there is an easy way to have the program switch between a development connection string and a production connection string based on whether...

C# string convention parsing

I'm rather new to C# and have a user input string (valid I hope.) This string will make up multiple sections and subsections of information. For example: 1-7 will //represent values 1 2 3 4 5 6 7 3:.25:7 //will be the numbers contained between 3 and 7 in increments of .25 // (3 3.25 3.5 3.75 4 ... 6.75 7) 1,4,5 //will repre...

strings, fill in the blank. C#

I have a string aBc12def6 i want to convert the string into a pattern template (say aBc##def#) then generate values to place into the blank spaces (ex aBc00def0, aBc00def1 ... aBc25def9 ...). I dont want to do it all at once. I want to generate it one at a time and test the string. How do i do this? using C# ...

error c2664 upon using basic_string<wchar_t> abc("hello") in vc++ 9.0

Hi upon compiling this code in Visual studio 2008 i get the following error #include<iostream> #include<string> using namespace std; void main() { basic_string<wchar_t> abc("hello world"); cout<<abc; return; } error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::basic_string(std::basic_string<_Elem,_Traits,_Ax>::_Has_deb...

Find the last value in a "rolled-over" sequence with a stored procedure?

Suppose I had a set of alpha-character identifiers of a set length, e.g. always five letters, and they are assigned in such a way that they are always incremented sequentially (GGGGZ --> GGGHA, etc.). Now, if I get to ZZZZZ, since the length is fixed, I must "roll over" to AAAAA. I might have a contiguous block from ZZZAA through AAAA...

convert string to char c

Hello, I am working on a project where I can to convert a api digit to a char. I have used an array of string pointers to get the conversion. However, I want to return just a single ch, as my api that I am using will only accept a char. So ap_five will return "5". But I want to five to be a single char '5'. I thought maybe I could cast...

Base64 String throwing invalid character error.

I keep getting a Base64 invalid character error even though I shouldn't. The program takes an XML file and exports it to a document. If the user wants, it will compress the file as well. The compression works fine and returns a Base64 String which is encoded into UTF-8 and written to a file. When its time to reload the document into th...

Most efficient way to convert a string to 2 decimal places in C#

I have a string which needs a decimal place inserted to give a precision of 2. 3000 => 30.00 300 => 3.00 30 => .30 ...