Search found 12004 matches

by fxm
Apr 22, 2024 14:19
Forum: Beginners
Topic: Count character
Replies: 8
Views: 261

Re: Count character

For i As Integer = 1 To 1024 Len(my_string) (otherwise, lots of ghost null characters are counted from the the string end index up to 1024 index) Your first code displays in the first line the value corresponding to: 1024 - Len(my_string) = 1024 - 156 = 868 What exactly do you want to display on th...
by fxm
Apr 22, 2024 13:16
Forum: Beginners
Topic: Count character
Replies: 8
Views: 261

Re: Count character

For long strings (greater than 256 characters), where execution time becomes more noticeable, it is advantageous to filter certain characters only when displaying counters: Dim As String my_string = "screen 13:color 15,3:cls:line(100,100)-(150,150),,bf :dim as integer a = 10 : b,c,d : "&qu...
by fxm
Apr 22, 2024 11:55
Forum: Beginners
Topic: Count character
Replies: 8
Views: 261

Re: Count character

For i As Integer = 1 To 1024 Len(my_string)
(otherwise, lots of ghost null characters are counted from the the string end index up to 1024 index)
by fxm
Apr 22, 2024 8:19
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

In your case of member data fields ( 'Integer' and 'String' ), defining a copy-constructor by the user is useless because the compiler can itself manage the copy of these member data fields between 2 instances. In the case of member var-len string or member var-len array for example, it itself gener...
by fxm
Apr 21, 2024 18:00
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

If the topic "constructors, copy constructor, copy assignment, destructor" interests you especially, you can start by reading in the Programmer's Guide : - first the User Defined Types / Constructors and Destructors (basics) page, - then the User Defined Types / Constructors, '=' Assignmen...
by fxm
Apr 21, 2024 15:35
Forum: Beginners
Topic: UDT Constructor with Param
Replies: 7
Views: 304

Re: UDT Constructor with Param

For more information on 'Enum' than on the ENUM page of the manual, see also the Constants and Enumerations page of the Programmer's Guide.
by fxm
Apr 21, 2024 11:41
Forum: Beginners
Topic: UDT Constructor with Param
Replies: 7
Views: 304

Re: UDT Constructor with Param

In an 'Enum' structure, symbol names are encoded using the signed 'Integer' data type. So 2^32 or 2^64 different values are available for the 32-bit or 64-bit freeBASIC, respectively. But since multiple symbol names in an 'Enum' structure can be associated with the same value, the number of symbol n...
by fxm
Apr 20, 2024 19:11
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

In FreeBASIC, constructors, destructor, properties, member operators, member procedures, must all be declared inside the 'Type...End Type' structure, but must all be defined with their code body in outside this structure (this may perhaps change in the future).
by fxm
Apr 20, 2024 18:20
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

Note:
You can add the code tags by pressing the "</>" button on the selected code body.
by fxm
Apr 20, 2024 16:48
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

For example: Type Superhero _name As String _powerLevel As Integer Declare Constructor () Declare Constructor (names As String, powerLevel As Integer) Declare Constructor (other As Superhero) Declare Function Calculate(value2 As Integer) As Integer Declare Destructor () Declare Operator Cast () As S...
by fxm
Apr 20, 2024 16:12
Forum: Beginners
Topic: UDT Constructor with Param
Replies: 7
Views: 304

Re: UDT Constructor with Param

There is no size limitation for an 'Enum' structure in FreeBASIC.
by fxm
Apr 20, 2024 15:54
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

If I knew what you wanted to do with the second 'Superman' type in addition to the first 'SuperHero' type, maybe I could help you Yesss feel free to Help :-D I wrote that I could help you only if I understood what you want to do with the second 'Superman' type compared to the first 'Superhero' type.
by fxm
Apr 20, 2024 14:28
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

If I knew what you wanted to do with the second 'Superman' type in addition to the first 'SuperHero' type, maybe I could help you?
by fxm
Apr 20, 2024 12:29
Forum: Beginners
Topic: Constructor Copy
Replies: 14
Views: 571

Re: Constructor Copy

- Instead of defining a 'cleanup()' method, you can define a 'destructor()' which will be automatically called before the object is destroyed. - The 'calculate()' method does not use any member fields. So you can declare it as static and simply call it on the type name and not necessarily on the nam...
by fxm
Apr 20, 2024 5:35
Forum: General
Topic: Const error (Expected End-of-Line)
Replies: 8
Views: 405

Re: Const error (Expected End-of-Line)

New update: Operator [] (String index) ..... Usage: result = lhs [ rhs ] ..... Parameters: lhs : The string (a string reference, not a string returned as local copy) lhs : The string variable or a string reference (not for example a constant or a string returned as a local copy). rhs : A zero-based ...