Re: New User
> function replace (structure findstring, structure replacestring,
> structure originalstring)
> atom ix
> ix=find (findstring, originalstring)
> return originalstring[1..ix-1] & replacestring &
> originalstring[ix+length(findstring)..length(originalstring)]
> end function
>
> again I haven't done any check to see if it exists. But you can see how
> string functions in Euphoria almost write themselves - particularly when
> you know how useful find is.
keep in mind, match() works better when finding chucks of strings in larger
chunks of strings. if i want to find "DEF" in a string "ABCDEFG" i would use
i = match("DEF", "ABCDEFG") in which i = 4 as the first position to
which "DEF" matches. it does get a bit confusing sometimes, but it works
well.
> Ideally I want to do this using variable fonts (I can do it without too
> much difficulty with a fixed font). I suppose that this is possible as I
> saw a function somewhere(the name of which I forget) that returns the
> pixel length of a string so I can keep adding another word until I pass
> the place that I want to stop and then take one word back, chuck in a NL
> and carry on.
the function, if you're using Win32Lib is getTextExtent() which returns
(off the top of my head) {max_height, max_width, min_height, min_width,
total_height, total_width} as for EUwinGUI, i'm sure there is an equivalent
function somewhere. this works on all fonts, fixed or variable widths.
~Greg
g.haberek at comcast.net
|
Not Categorized, Please Help
|
|