Announcement

Collapse
No announcement yet.

How ignore the input when starts with 0?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How ignore the input when starts with 0?

    How ignore the input when starts with 0?

    Eg: if I put 23 or 023 or 00023 the function goes to page 23.
    I'm using input box with mask #####

    Code:
    -- search box
    function boxSearch()
    	idBox = Input.GetText("box_search");
    	idToNumber = String.ToNumber(idBox);
    	pnToNumber = String.ToNumber(page_name);
    
    	if pnToNumber == idToNumber then
    		Dialog.Message("Attention!", "The page is already active!", 0, 64, 0);
    		Page.SetFocus("box_search");
    	end
    
    	Page.Jump(""..idToNumber.."");
    
    	if idToNumber ~= "" then
    		Dialog.Message("Error!", "ID not found!", 0, 64, 0);
    		Page.SetFocus("box_search");
    	end
    end

  • #2
    Code:
    String.TrimLeft(szInputString, "0 ");
    This will trim 0's and spaces from the left.
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment

    Working...
    X