How can I replace this "a b" by "a b" in j2me?
the replace() method doesn't accept Strings, but only chars. And since a double space contains two chars, I think i have a small problem.
I have a very simple function that takes a list of comma separated (x,y) points and imports them into a graph. I have FF, Chrome and IE8 installed. I use IETester to test for IE6 and IE7.
// Import Data
this.Import = function(data) {
alert("Data in: "+data);
var d;
// Make sure the first and the last are start/ending parenthesis
…
Hi guys,
I wanted to know if theres a single method or way that will help me replace strings for specific characters.
like MALE - M
FEMALE - F
CHILD - P
The longer way out is this..
[str stringByreplacingOccurencesOfString:@"MALE" withString:@"M"];
[str stringByreplacingOccurencesOfString:@"FEMALE" withString:@"F"];
[str…
I have an NSAttributedString s and an integer i and I'd like a function that takes s and i and returns a new NSAttributedString that has a (stringified) i prepended to s.
It looks like some combination of -stringWithFormat:, -initWithString:, and -insertAttributedString: would do it but I'm having trouble piecing it together…
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…
Let's say that I have the following text:
input = "one aaa and bbb two bbbb er ... // three cccc"
I would like to parse this into a group of variables that contain
criteria = ["one", "two", "three"]
v1,v2,v3 = input.split(criteria)
I know that the example above won't work, but is there some utility in python that…
From what I can tell, = and != is supposed to work on strings in OCAML. I'm seeing strange results though which I would like to understand better.
When I compare two strings with = I get the results I expect:
# "steve" = "steve";;
- : bool = true
# "steve" = "rowe";;
- : bool = false
but when I try != I do not:
#…
I have a distance as a float and I'm looking for a way to format it nicely for human readers. Ideally, I'd like it to change from m to km as it gets bigger, and to round the number nicely. Converting to miles would be a bonus. I'm sure many people have had a need for one of these and I'm hoping that there's some code…
I can't figure out what to do to make this work. Here's my code:
char* testStr = " trim this ";
char** pTestStr = &testStr;
trim(pTestStr);
int trim(char** pStr)
{
char* str = *pStr;
while(isspace(*str)) {
(*pStr)++;
str++;
}
if(*str == 0) {
return 0;
}
char *end = str +…
I'm working with the fulltext search engine of MSSQL 2008 which expects a search string like this:
("keyword1" AND "keyword2*" OR "keyword3")
My users are entering things like this:
engine 2009
"san francisco" hotel december xyz
stuff* "in miami" 1234
something or "something else"
I'm trying to…
Hi,
I'm trying to shorten a wordpress title to just the first word. For a page named "John Doe" I want to have a sub title somewhere on the page that says "About John" so I want to just get the first word from the title.
Is there a way to do this with PHP?
Thanks!
I need to split some info from a asterisk delimitted data.
Data Format:
NAME*ADRESS LINE1*ADDRESS LINE2
Rules:
1. Name should be always present
2. Address Line 1 and 2 might not be
3. There should be always three asterisks.
Samples:
MR JONES A ORTEGA*ADDRESS 1*ADDRESS2*
Name: MR JONES A ORTEGA…
Hi,
Could you please have a look at my code below.
#!C:\Perl\bin\perl.exe
use strict;
use warnings;
use Data::Dumper;
my $fh = \*DATA;
my $str1 = "listBox1.Items.Add(\"";
my $str2 = "\")\;";
while(my $line = <$fh>)
{
$line=~s/^\s+//g;
print $str1.$line.$str2;
chomp($line);…
have funciton in my object which is called regularly.
parse : function(html)
{
var regexp = /...some pattern.../
var match = regexp.exec(html);
while (match != null)
{
...
match = regexp.exec(html);
}
...
var r = /...pattern.../g;
var m = r.exec(html);
}…
Hi all,
I'm new to pgf so i was trying out some examples from the pgfplot manual. One example is especially relevant for my current task but, alas, it would not compile.
Here is the code:
\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
…
I need to split some info from a asterisk delimitted data.
Data Format:
NAME*ADRESS LINE1*ADDRESS LINE2
Rules:
1. Name should be always present
2. Address Line 1 and 2 might not be
3. There should be always three asterisks.
Samples:
MR JONES A ORTEGA*ADDRESS 1*ADDRESS2*
Name: MR JONES A ORTEGA…
CodeSmith has a nice StringUtils class that can be used to change database object names to singular, plural, camel case, pascal case, etc... Very useful for creating data access layers in their code generation tool.
I'm trying to port some CodeSmith templates to the T4 template files used by Visual…
Write your own version of the strcmp function string_compare.
Supply a main program that will test each of the 3 differing outcomes.
int string_compare(char *s, char *t);
returns
<0 if s is lexically before t
0 if s is identical to t
>0 if s is lexically after t
Something strange happened in my codes, actually I have a hyperlink that pass ID value in a query string to second page.in second page i have 2 sql datasource that both these sql datasources should get this id value and pass it to a filter parameter to show sth in datalist.
so in another word I have…
Looking for a simple SQL (PostgreSQL) regular expression or similar solution (maybe soundex) that will allow a flexible search. So that dashes, spaces and such are omitted during the search. As part of the search and only the raw characters are searched in the table.:
Currently using:
SELECT * FROM…
hi all,
i'm accessing the stylesheet collection like this:
var css = document.styleSheets[0];
it returns eg. http://www.mydomain.com/css/main.css
question: how can i strip the domain name to just get /css/main.css ?
thx