Xojo instr
If (InStr(format, "z") > 0) OR (InStr(format, "O") > 0) OR (InStr(format, "x") > 0) then // restore the timeĪDate.Hour = aDate.Hour + aDate.
#Xojo instr code#
ReturnValue = stringFromDate(aNSDateFormatter, dateWithTimeIntervalSince1970(NSDateClass, seconds)) I’m writing an app to find and replace parts of text in the rows of a listbox, i’ve got most of it working but cannot get InStr to find apostrophes in the string value to replace it Here is the code stocheck listbox1. Seconds = aDate.TotalSeconds - since1970.TotalSeconds - (3600 * aDate.GMTOffset)
![xojo instr xojo instr](https://forum.xojo.com/uploads/default/optimized/2X/9/9bc583602ed897d90485a10864784442479ce41a_2_1024x355.png)
SetLocale aNSDateFormatter, currentLocale(NSLocaleClass) If (InStr(format, "z") > 0) OR (InStr(format, "O") > 0) OR (InStr(format, "x") > 0) then // modify the time for the time zoneĪDate.Hour = aDate.Hour - aDate.GMTOffsetĭIM aNSDateFormatter As Ptr = init(alloc(NSDateFormatterClass)) Static NSLocaleClass As Ptr = NSClassFromString("NSLocale") Function used to determine whether one string contains another string. It's only an example showing how you could code for such a payment. Static NSDateFormatterClass As Ptr = NSClassFromString("NSDateFormatter") Paypal Payment example from Jean-Luc ARNAUD, provided as is, WITHOUT any warranty.
#Xojo instr update#
That way, if the user types, the list will either update after 0.3s automatically, or immediately if the user types Return.I haven’t played with the new framework stuff yet, so this code is pretty much for the old Date class (am waiting for 64-bit before I purchase a new license)… This code is for Cocoa and will allow you to use strings to format the date how you want it… I have code for Windows and Linux that I need to convert and test…įunction ToString(Extends aDate As Date, format As String) As Stringĭeclare Function alloc Lib “Cocoa” Selector “alloc” (classRef As Ptr) As Ptrĭeclare Function currentLocale Lib “Cocoa” Selector “currentLocale” (classRef As Ptr) As Ptrĭeclare Function dateWithTimeIntervalSince1970 Lib “Cocoa” Selector “dateWithTimeIntervalSince1970:” (classRef As Ptr, seconds As Double) As Ptrĭeclare Function init Lib “Cocoa” Selector “init” (instanceRef As Ptr) As Ptrĭeclare Function NSClassFromString Lib “Cocoa” (className As CFStringRef) As Ptrĭeclare Function stringFromDate Lib “Cocoa” Selector “stringFromDate:” (aNSDateFormatter As Ptr, aNSDate As Ptr) As CFStringRefĭeclare Sub setDateFormat Lib “Cocoa” Selector “setDateFormat:” (aNSDateFormatter As Ptr, format As CFStringRef)ĭeclare Sub setLocale Lib “Cocoa” Selector “setLocale:” (aNSDateFormatter As Ptr, locale As Ptr) Static NSDateClass As Ptr = NSClassFromString("NSDate")
![xojo instr xojo instr](https://forum.xojo.com/uploads/default/original/2X/3/352487a6fdbf0b0a6b34907c13fed554634b070f.png)
Make a method that rebuilds the entire ListBox, but also checks an optional filter variable (set from the TextField's Text property - don't invoke this every time in the loop, as it'll slow things down - use a local variable that holds a copy of the string instead): If it's non-empty, then check with InStr() if the to-be-added rows match the filter string and only add them if they match.Chr, InStr, Left, Len, Mid, Right functions TextEncoding class.