Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 111
Registered: ‎12-16-2008
My Device: Not Specified
Accepted Solution

Resource help, need to store a couple of large strings

Hi- My application needs to store 3 large static strings (4, 6, and 36KB in size). The app searches for a match on text in each of these strings once each time it is run.

 

I have seen some obscure examples on resource files online and in the developer guide, but I'm wondering if someone can give me a simple example. I'm not looking for an i18n example... I just want to store 3 long strings and access them from my program.

 

Specifically, I need to know how to get them into the IDE and compile them into my program, and then also how to access them in my program. I'm using JDE 4.7.0.

 

Any help will be much appreciated! Thanks,

Nicholas

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Resource help, need to store a couple of large strings

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Resource help, need to store a couple of large strings

[ Edited ]

Taking this question more literally("I need to know how to get them into the IDE and compile them into my program") , and I think it is reasonable to do so, he is looking for a code generator.

I normally use cygwin bash scripts for stuff like this  calling mostly grep, awk, and sed. If you just want to extract strings, depending on the source of your strings, you can usually find some way to put them on the clipboard (/dev/clipboard in cygwin) and paste them into your editor screen.

 

If you are going to include a file in your jar it may be reasonable to consider generated code instead.

For your strings it may not matter much but someone else was asking about Mbyte strings. Presumably you

could also use PERL or your own c++ code to index the strings to facilitate searching or whatever you plan on

doing ( at least sort them for later binary search etc).

 

Message Edited by marchywka on 01-03-2009 08:09 AM
Developer
Posts: 111
Registered: ‎12-16-2008
My Device: Not Specified

Re: Resource help, need to store a couple of large strings

Ah-ha! That knowledgebase article was just what I needed! Up and running in a few minutes. Many thanks for your help.

 

Nicholas

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Resource help, need to store a couple of large strings

You're welcome Smiley Happy