[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Getting last character from a string

Nuralanur

2/12/2006 12:12:00 AM

you can use

text="my unfinishing text with an unknown last character"
result=text[-1].chr
p result => r

2 Answers

Jim Mack

9/24/2013 8:58:00 PM

0


> (aa) I'm setting Karl's CCRP countdown timer to the time to next
> subtitle, it counts down and Timer event triggers. I display the
> subtitle, then set the countdown timer to the read time. The event
> triggers and I clear the subtitle, then return to (aa).
>
> The timings in milliseconds are derived from the start/stop times in
> the .srt file.

While it would be ideal to get access to the player's position via an
API, the next best thing would be to store the system time when you
begin, then check (system time - stored time) every tick of an interval
timer (like the CCRP timer). When the difference is >= the next caption
time, display that caption and index to the next. timeGetTime() should
provide as accurate a system time as you need, reported in mSec.

Relying on a timer to provide continuous, incremental accuracy is not
likely to work well. As you've seen.

--
Jim

(Mike Mitchell)

9/25/2013 10:28:00 AM

0

On Tue, 24 Sep 2013 16:58:13 -0400, Jim Mack <no-ube-uce@mdxi.com>
wrote:

>
>> (aa) I'm setting Karl's CCRP countdown timer to the time to next
>> subtitle, it counts down and Timer event triggers. I display the
>> subtitle, then set the countdown timer to the read time. The event
>> triggers and I clear the subtitle, then return to (aa).
>>
>> The timings in milliseconds are derived from the start/stop times in
>> the .srt file.
>
>While it would be ideal to get access to the player's position via an
>API, the next best thing would be to store the system time when you
>begin, then check (system time - stored time) every tick of an interval
>timer (like the CCRP timer). When the difference is >= the next caption
>time, display that caption and index to the next. timeGetTime() should
>provide as accurate a system time as you need, reported in mSec.

Another good idea which I shall try later. Thanks.

>Relying on a timer to provide continuous, incremental accuracy is not
>likely to work well. As you've seen.

Indeed.

MM