Hey everyone, I would like to wrap the String.format() method with in my own Logger class. I can't figure a way how to pass arguments from my method to String.format().
public class Logger
{
public static void format(String format, Object... args)
{
print(String.format(format, args)); // <-- this gives an error obviousl...
In PHP, I need to be able to figure out if a string contains a URL. If there is a URL, I need to isolate it as another separate string.
For example: "SESAC showin the Love! http://twitpic.com/1uk7fi"
I need to be able to isolate the URL in that string into a new string. At the same time the URL needs to be kept intact in the original ...
Hello! My problem can be described the following way:
I have some data which actually is an array and could be represented as char* data with some size
I also have some legacy code (function) that takes some abstract std::istream object as a param and uses that stream to retrieve data to operate.
So, my question is the following - wha...
Hello,
I have a string like this The theme song of whatever - http://www.anydomain.com/pop_new.php?sid=10623&aid=1581&rand=0.6808111508818073 #string
And now, I need to do the following thing.
Get the url from above string http://www.anydomain.com/pop_new.php?sid=10623&aid=1581&rand=0.6808111508818073
Replace the url ...
Hi,
I have been given a task at school to write a program that
Reads three strings
Stores the third string in dynamically allocated memory
Print out the last 4 letters of the first word alphabetically.
Here is the program I have so far. The strings are all stored in different variables, making them hard to sort. If anyone could give...
I noticed a Python script I was writing was acting squirrelly, and traced it to an infinite loop, where the loop condition was "while line is not ''". Running through it in the debugger, it turned out that line was in fact ''. When I changed it to != rather than 'is not', it worked fine.
I did some searching, and found this question, t...
Hi,
How can i extricate substring from string using powershell ?
I have this string: "-----start-------Hello World------end-------", i have to the hello world.
What is the best way to do that?
Thanks!
...
In my application i'm declaring a string variable near the top of my code to define the name of my window class which I use in my calls to RegisterClassEx, CreateWindowEx etc.. Now, I know that an LPCTSTR is a typedef and will eventually follow down to a TCHAR (well a CHAR or WCHAR depending on whether UNICODE is defined), but I was wond...
Hi im having a few problems rotating a string, i found that you need graphics.rotate() but when i change the rotation, i cannot even see the string. It appears the pivot point has completely thrown me. Also i saw an example with transform but i decided i did not need this?
If my string was a graph label, reading top to bottom and i need...
If I have a wstringstream, and I want to get its .str() data as a LPCWSTR, how can I do that?
...
I have a ByteBuffer containing bytes that were derived by String.getBytes(charsetName), where "containing" means that the string comprises the entire sequence of bytes between the ByteBuffer's position() and limit().
What's the best way for me to get the string back? (assuming I know the encoding charset) Is there anything better than ...
Do I need to allocate memory when performing a Delphi string copy?
I've a function which posts a Windows message to another form in my application. It looks something like this:
// Note: PThreadMessage = ^TThreadMessage; TThreadMessage = String;
function PostMyMessage( aStr : string );
var
gMsgPtr : PThreadMessage;
gStrLen : Int...
Hi all,
I need help in trimming everything in my string till end after it encounters the first "\0"
So:
"test\1\2\3\0\0\0\0\0\0\0\0\0_asdfgh_qwerty_blah_blah_blah"
becomes
"test\1\2\3"
I am using c#. Help would be greatly appreciated.
Thanks.
...
I have a List of string array already populated in storeInv. How do i change a specific element in the string array? For example the code below...
Thanks =]
List <String[]> storeInv ; //assume already populated with elements
String[] store = storeInv.get(5);
store[1] = 123;
store.set(5, store[1]); //this gives me an error.
...
Hi,
I'm trying to write a regular expression that will strip all tag attributes except for the SRC attribute. For example:
<p id="paragraph" class="green">This is a paragraph with an image <img src="/path/to/image.jpg" width="50" height="75"/></p>
Would be returned as:
<p>This is a paragraph with an image <img src="/path/to/image.jp...
Hi guys,
In TSQL, how can I get the rindex functionality(search a substring from right and get the position)?
Great thanks.
...
Hi,
I have a string like this:
"user=u123;name=Test;lastname=User"
I want to get a dictionary for this string like this:
user "u123"
name "Test"
lastname "User"
this way I can easely access the data within the string.
I want to do this in C#.
EDIT:
This is what I have so far:
public static Dictionary<string, string> V...
I have a string which contains a contiguous chunk of digits and then a contiguous chunk of characters. I need to split them into two parts (one integer part, and one string).
I tried using String.split("\D", 1), but it is eating up first character.
I checked all the String API and didn't find a suitable method.
Is there any method for ...
Hello,
I have a problem with many valgrind warnings about possible memory leaks in std::string, like this one:
120 bytes in 4 blocks are possibly lost in loss record 4,192 of 4,687
at 0x4A06819: operator new(unsigned long) (vg_replace_malloc.c:230)
by 0x383B89B8B0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::...
Dear all,
I can't figure out how to optimally do the following in PHP:
In a database, I have messages with a unique ID, like 19041985. Now, I want to refer to these messages in a short-url service but not using generated hashes but by simply 'calculate' the original ID.
In other words, for example: http://short.url/sYsn7 should let me ...