findRichText issue

Hi,

I am trying to use the function findRichText on some rich text taken directly from an object, but DOORS does not seem to recognise its own formatting as rich text.

Assume the object text reads: Start of text object.

This is the code I am trying to use, which does not work (it would print (Not found"):

Object o = current
int i_offset, i_length
string s_text_rich = richText(o."Object Text")
 
if (findRichText(s_text_rich, "Start of", i_offset, i_length, true))
{
    print "Found"
}
else print "Not found"

 


The problem is that s_text_rich will read something like
"{Start \b of \bo\i text \io object}"

but in order to use findRichText it needs to have { before each \\ like this:
"{Start {\\b of {\\b0{\\i text {\\i0 object}}}}}"

Is there a way of using findRichText directly on rich text taken out of an object, without having to go through and inserting {\ before each delimiter?

Thanks,
Simon

 


SystemAdmin - Tue Dec 14 05:18:10 EST 2010

Re: findRichText issue
SystemAdmin - Thu Dec 16 08:24:32 EST 2010

Your example seems to work if you drop off the richText call when fetching the attribute value, i.e.
 

string s_text_rich = o."Object Text"

Re: findRichText issue
SystemAdmin - Thu Dec 16 08:35:59 EST 2010

SystemAdmin - Thu Dec 16 08:24:32 EST 2010

Your example seems to work if you drop off the richText call when fetching the attribute value, i.e.
 

string s_text_rich = o."Object Text"

Hi,

Thanks for the reply. That's true, it would work is you do not include the rich text in the string, but that's because you then do not have the rich text tags in the string so the findRichText function works the same ws as a normal contains function.

The problem I am having is getting DOORS to understand the rich text tags when using the function findRichText. It does not seem to recognise the tags when they are taken directly from an object as they come out as \b rather than {\\b.

Thanks,
Simon