Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
User Experience
Lawson Design Studio
Java Array Creation error
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
NonnieBear1776
Past 24 Hours:
0
Prev. 24 Hours:
1
Overall:
5162
People Online:
Visitors:
219
Members:
0
Total:
219
Online Now:
New Topics
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3288
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1348
Roger French
1311
mark.cook
1244
Forums
Unanswered
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
Lawson Design Studio
Java Array Creation error
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
brihyn
Veteran Member
Posts: 95
2/17/2011 1:30 PM
I've got some java scripting to assist with pulling up images, and for one section, I need to strip out leading 0's that are on the screen to find the correct image. I found some great code on the web, but Lawson is screaming at the commented-out line where I declare the array. Is there a way to do this that Design Studio approves of?
Here's the code I have:
function removeLeadingZeros(str)
{
if (str == null)
{
return null;
}
// char[] chars = str.toCharArray();
index = 0;
for (; index < str.length();index++)
{
if (chars[index] != '0')
{
break;
}
}
return (index == 0) ? str :str.substring(index);
}
Sam Simpson
Veteran Member
Posts: 239
2/17/2011 8:46 PM
Is toCharArray() a valid javascript? I thought this was usually used in VB where you load string into a unicode array.
brihyn
Veteran Member
Posts: 95
2/17/2011 8:57 PM
you might be right. Found another possible solution, but Lawson isn't liking it either. The search goes on.
Sam Simpson
Veteran Member
Posts: 239
2/17/2011 9:02 PM
I guess to answer my question, toCharArray() is a valid statement used by JVM. It is one way of converting your str into an array called chars (without declaring an array). Going back to your dilemna, I don't know if the function is a valid function in design studio. Maybe there is a need to update your JVM.
John Henley
Senior Member
Posts: 3348
2/17/2011 9:30 PM
Also C#.
try:
var chars = str.split()
John Henley
Senior Member
Posts: 3348
2/17/2011 9:36 PM
Or, better:
str.replace(/^[0]+/g,"")
You are not authorized to post a reply.