string-manipulation

web crawl app but encountered errors

I am trying to create a web crawl application to access the Chicago White Sox website and pull off the date of the next game. The application then goes to the 10 day forecast of the team's stadium and pulls the weather from there. I am wondering how to display just the forecast of the game, and not the full 10 day forecast. The pointe...

Remove special chars from URL

Hi, I have a product database and I am displaying trying to display them as clean URLs, below is example product names: PAUL MITCHELL FOAMING POMADE (150ml) American Crew Classic Gents Pomade 85g Tigi Catwalk Texturizing Pomade 50ml What I need to do is display like below in the URL structure: www.example.com/products/paul-mitchell-...

Remove whitespace in as3

How can one remove whitespace from a string in as3? I would like to be able to remove all carriage returns, spaces, tabs etc. ...

Date conversion in Java

How can I take a string in a format such as: 2008-06-02 00:00:00.0 and convert it to: 02-Jun-2008? Can I somehow take the original string, convert it to a Date object, then use a formatter to get the final output (rather than parsing the string myself)? Thanks! ...

Algorithm to see if keywords exist inside a string

Let's say I have a set of keywords in an array {"olympics", "sports tennis best", "tennis", "tennis rules"} I then have a large list (up to 50 at a time) of strings (or actually tweets), so they are a max of 140 characters. I want to look at each string and see what keywords are present there. In the case where a keyword is composed o...

Changing href attributes with nokogiri and ruby on rails

Hi, I Have a HTML document with links links, for exemple: <html> <body> <ul> <li><a href="http://someurl.com/etc/etc"&gt;teste1&lt;/a&gt;&lt;/li&gt; <li><a href="http://someurl.com/etc/etc"&gt;teste2&lt;/a&gt;&lt;/li&gt; <li><a href="http://someurl.com/etc/etc"&gt;teste3&lt;/a&gt;&lt;/li&gt; <ul> </body> </html...

Regular Expression Question

I'm trying to use regular expression to extract the comments in the heading of a file. For example, the source code may look like: //This is an example file. //Please help me. #include "test.h" int main() //main function { ... } What I want to extract from the code are the first two lines, i.e. //This is an example file. //Please...

javascript regex to extract a word from middle of 6 sentence

i have a string like following: Assigned to ram on 2010-04-22 12:30:13.0 i need to extract the third word (ram). I tried the below regex, its not working. /\s[a-zA-Z]*\s/ any help to fix this would be greatly appreciated. ...

What's the most efficient way to pull culture information out of a resx's filename in c#?

What's the most efficient way to pull culture information out of a resx's filename using C#? The solution should also handle there not being culture info in the file name (ie form1.resx). In that case a string assigned "Default" should be returned. ...

String Formatting Tricks/Docs

Was reading the response by Shaggy Frog to this post and was intrigued by the following line of code: NSLog(@"%@", [NSString stringWithFormat:@"%@:%*s%5.2f", key, padding, " ", [object floatValue]]); I know string formatting is an age old art but I'm kinda doing the end around into Cocoa/Obj-C programming and skipped a few grades alo...

Java Regular Expression. Check if String contains ONLY Letters

How do I check if a String contains only letters in java? I want to write an if statement that will return false if there is a white space, a number, a symbol or anything else other than a-z A-Z. My string must contain ONLY letters. I thought I could do it this way, but I'm doing it wrong: if( ereg("[a-zA-Z]+", $myString)) return tr...

How to delete characters and append strings?

i am adding a new record to xml file im first quering all existing items and storing the count in an int int number = query.count() and then incrementing number by 1; number = number +1; now i want to format this value in a string having "N00000000" format and the number will ocuppy the last positions Pseudo code: //declare the...

How Do I Pull Info from String

I am trying to pull dynamics from a load that I run using bash. I have gotten to a point where I get the string I want, now from this I want to pull certain information that can vary. The string that gets returned is as follows: Records: 2910 Deleted: 0 Skipped: 0 Warnings: 0 Each of the number can and will vary in length, but the o...

Ruby delete method (string manipulation)

I'm new to Ruby, and have been working my way through Mr Neighborly's Humble Little Ruby Guide. There have been a few typos in the code examples along the way, but I've always managed to work out what's wrong and subsequently fix it - until now! This is really basic, but I can't get the following example to work on Mac OS X (Snow Leopar...

String Manipultation - Get String between two other Strings?

I have a large piece of text in which there is something simular to this: !#_KT_#!COMMANDHERE!#_KT_#! I want, in VB.Net, to get the 'COMMANDHERE' part of the string, how would I go about doing this? I have this so far: Dim temp As String = WebBrowser1.Document.Body.ToString Dim startIndex As Integer = temp.IndexOf("!#__KT__#!") + 1 Di...

Java StringTokenizer, empty null tokens

I am trying to split a string into 29 tokens..... stringtokenizer won't return null tokens. I tried string.split, but I believe I am doing something wrong: String [] strings = line.split(",", 29); sample inputs: 10150,15:58,23:58,16:00,00:00,15:55,23:55,15:58,00:01,16:03,23:58,,,,,16:00,23:22,15:54,00:03,15:59,23:56,16:05,23:59,15:55...

C++ String manipulation isn't making sense to me...

This particular assignment has to do with removing substrings from strings; I am trying some of the Stanford SEE courses online to learn some new languages. What I've got so far is below, but if text = "hello hello" and remove ="el", it gets stuck in a loop, but if i change text to text = "hello hllo", it works, making me think I'm doi...

PHP Extract Values From One String Based on a Pattern Defined in Another

I have two strings: $first = '/this/is/a/string'; $second = '/this/:param1/a/:param2'; And I'm trying to get this: $params = array('param1' => 'is', 'param2' => 'string'); But getting from point a to b is proving more than my tired brain can handle at the moment. Anything starting with a ':' in the second string defines a variab...

how to write floating value accurately to a bin file.

Hi I am trying to dump the floating point values from my program to a bin file. Since I can't use any stdlib function, I am thinking of writting it char by char to a big char array which I am dumping in my test application to a file. It's like float a=3132.000001; I will be dumping this to a char array in 4 bytes. Code example woul...

Concatenate strings in python 2.4

Python newbie question How to concatenate strings in python like Section = 'C_type' Concatenate it with 'Sec_' to form the string : Sec_C_type ...