AfterLast
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

AfterLast

Started by Icanos, 16 June, 2004, 18:46:08

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Icanos

Hello

I wounder if someone can try to translate this VB code (from NMDC) to LUA

Function AfterLast(sIn,sLast)
AfterLast = Right(sIn,Len(sIn) - InstrRev(sIn,sLast,-1) - (Len(sLast) - 1))
End Function

Thanks to you who tries to translate it.

// Icanos

plop

tinsert(TableName, DataToInsert)

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
tinsert(TableName, DataToInsert)

plop

???
Resistance is futile!

pHaTTy

Function AfterLast(sIn,sLast) 
	AfterLast = Right(sIn,Len(sIn) - InstrRev(sIn,sLast,-1) - (Len(sLast) - 1)) 
End Function

function AfterFirst(control,data)
	local s,e,first,data = strfind(data,control.."(%S+)")
	return data
end;


function AfterLast(control,data)
	local s,e,first,data = strfind(data,control.."(%S+)")
	-- // now lets loop til the end
	bool somevar = false;
	while(somevar == false)
	{
		local tempvar = data;
		local s,e,first = strfind(data,control)
		if first then
			local s,e,first,data = strfind(data,control.."(%S+)")
			if data then
				-- // hummm
			else
				data = tempvar;
				somevar = true;
			end;
		end
	}
	return data
end;
Resistance is futile!

pHaTTy

oops soz lol need to practice liua bit again lol

function AfterLast(control,data)
	local true = 1;	local false = 2
	local s,e,first,data = strfind(data,control.."(%S+)")
	-- // now lets loop til the end
	local somevar = false;
	while (somevar == false) then
		local tempvar = data;
		local s,e,first = strfind(data,control)
		if first then
			local s,e,first,data = strfind(data,control.."(%S+)")
			if data then
				-- // hummm
			else
				data = tempvar;
				somevar = true;
			end;
		end
	end;
	return data
end;
Resistance is futile!

NotRabidWombat

#5
function AfterLast(sIn, sLast)
   local _, _, ret = strfind(sIn, ".*".. sLast .. "(.-)$");
   return ret;
end
You just have to be carefull that sLast is not a special regex character recognized by strfind.
See the lua manual for more information: http://www.lua.org/manual/4.0/manual.html#6.2

Phatty, %S will only capture non white space characters.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

pHaTTy

QuoteOriginally posted by NotRabidWombat
function AfterLast(sIn, sLast)
   local _, _, ret = strfind(sIn, ".*".. sLast .. "(.-)$");
end
You just have to be carefull that sLast is not a special regex character recognized by strfind.
See the lua manual for more information: http://www.lua.org/manual/4.0/manual.html#6.2

Phatty, %S will only capture non white space characters.

-NotRabidWombat

humm i'll keep that in mind thanks, will av to come back tolua soon anyways ;-)
Resistance is futile!

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by plop
tinsert(TableName, DataToInsert)

plop

???
makes it clear that i don't know vbs. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NotRabidWombat

Be glad. I felt dumber after using vbs.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

pHaTTy

Quotemakes it clear that i don't know vbs. lol

plop

you dont want to neither mate lol, to slow n c..p


QuoteOriginally posted by NotRabidWombat
Be glad. I felt dumber after using vbs.

-NotRabidWombat

eheh funny this is so did i :/ lol
Resistance is futile!

plop

i've planned 2 keep it like this.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
i've planned 2 keep it like this.

plop

hahh good, altho u shud try c/c++, very nice language c, i was also thinking about checking out delphi, but ive heard its unstable, light on memory and cpu, but unstable so i duno, and due to yhub being port bombed and yhub crashing comp, im guessing thats the unstableness lol
Resistance is futile!

Icanos

Thanks to you all! Love u :P

SMF spam blocked by CleanTalk