From: Jim Freeze Date: 2003-04-12T02:46:42+09:00 Subject: Re: rb_str_chomp or rb_str_strip On Saturday, 12 April 2003 at 1:58:00 +0900, ts wrote: > >>>>> "J" == Jim Freeze writes: > > J> is #chomp! called via: > > J> res = rb_funcall2(str, rb_intern("chomp!"), 0, 0); > Is there an efficient way to test for a character in a string? Using rb_funcall, I could do: VALUE testchr = rb_str_new("+", 1); VALUE chr = rb_funcall(str,rb_intern("[]"), 1, INT2FIX(0)); Now that I have testchr and chr, I don't know how to compare them. and, it seems awfully inefficient. I'd rather do someting like: if ( '+' == *(RSTRING(str)->ptr) ) { but this doesn't seem to work either. Any help would be appreciated. Thanks -- Jim Freeze ---------- Captain Penny's Law: You can fool all of the people some of the time, and some of the people all of the time, but you Can't Fool Mom.