Jump to content

John Kouraklis

Members
  • Content Count

    111
  • Joined

  • Last visited

Community Reputation

15 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. John Kouraklis

    How to replace whole words in a string

    Thanks for the RegEx suggestions
  2. John Kouraklis

    How to replace whole words in a string

    Yes, but I don't want to write a function from scratch
  3. John Kouraklis

    How to replace whole words in a string

    @FredS What I need is to return 'yes, abc.def'
  4. John Kouraklis

    How to replace whole words in a string

    @Silver Black That's what I use now and sadly does not replace whole words. Eg. in this string 'abc and abc.def' if you want to replace 'abc' whole word only the above and the one from stringhelper will replace both instances of 'abc'
  5. John Kouraklis

    How to replace whole words in a string

    Hi, I am using TStringHelper.Replace to replace substrings in strings but it seems that it does not respect whole words. Anyone knows how to do this with Replace?
  6. John Kouraklis

    10.3.1 has been released

    Ok, upgrade completed and things seem to be in place except the Connection Managers. I can see the files in Documents. Anyone knows how to make the (new) IDE recognise them? Does it use the registry? Edit: It doesn't seem to recognise GetIt installed packages.....sadly
  7. John Kouraklis

    IDE Fix pack for Rio

    I am also installing 10.3.1 right now...let's see
  8. @Clément Thanks a lot for this👌
  9. @Mahdi Safsafi Thanks! the hack helps me a lot. About the debate regarding Create/Free, it looks to me it is good practice. Similar to this, I've seen people always but always setting interfaces to nil as a matter of coding style
  10. @Mahdi Safsafi Very cool. Thanks for this A couple of questions: 1. Do you need to create/Free TRTTIContext? All the books/articles I've seen they just use the record 2. The TypeInfo variable in DoSomething conflicts with TypeInfo from RTTI. It should use a different name, right? 3. How do I get the value of the fields now? I tried this: for lFields in LType.GetFields do Writeln(' '+lFields.Name + ': '+lFields.GetValue(TypeInfo(Rec)).AsString); but the instance in GetValue is not correct. Thanks again
  11. I would be great if this were possible...
  12. The goal is to extract the fields and their values from the record. The class function approach looks more promising but it looks such "openness" makes things complicated. I think I will pass the list of the fields directly rather than the record itself... Thanks everyone
  13. Hi, I want to write a function and allow the user of the function to pass a record that I do not know in advance. Then, the idea is I iterate through the fields in the function. Something like this: function pass (aRec: record): boolean; But a 'record' can't be used like this. I've thought of two approaches but without being able to make them work: 1. Use of pointers: function pass (aRP: Pointer): boolean; begin .... /// here I do not know how to (cast the pointer to any record and) iterate using RTTI /// I think this can not be done as the cast seems very arbitrary ... end; 2. A kind of adapter record: type TAdapterRec<T> = record instance: T constructor Create (aRec: T); end; and then tried to declare the function: function pass (aRec: TAdapterRec<T>): boolean; but generics like these are not allowed. Anyone can help with this? I would like to avoid using classes. Thanks
  14. @dummzeuch This is impossible to guess without any context. Maybe if you can sample a few numbers in the file you may be able to figure it out
  15. @Uwe Raabe Ah yes...
×